Allow for setuptools to automatically discover new modules under src/matrix_common#27
Merged
anoadragon453 merged 1 commit intomainfrom Jul 18, 2022
Merged
Conversation
Member
Author
|
Hmm, CI with Python 3.10.5 succeeded whereas 3.6 failed. I'll have to check why tomorrow. Edit: Looks like automatic discovery was only added in setuptools v61.0.0: pypa/setuptools#2894 |
Contributor
|
3.6 is end of life. Let's drop it. (https://endoflife.date/python) |
Member
|
taking this out of the review queue pending something happening about 3.6. |
We do this by simply removing the 'packages' and 'package_dir' options from setup.cfg.
3433162 to
28011ad
Compare
Member
Author
|
Python 3.6 dropped in #28. CI passes against Python 3.7+ 🎉 |
V02460
added a commit
to V02460/matrix-python-common
that referenced
this pull request
Oct 11, 2022
Use of the automatic discovery feature was intoduced with PR matrix-org#27. The feature is only available in setuptools version 61 and later, though, which this change documents in pyproject.toml.
V02460
added a commit
to V02460/matrix-python-common
that referenced
this pull request
Oct 11, 2022
Use of the automatic discovery feature was intoduced with PR matrix-org#27. The feature is only available in setuptools version 61 and later, though, which this change documents in pyproject.toml. Signed-off-by: Kai A. Hiller <V02460@gmail.com>
V02460
added a commit
to V02460/matrix-python-common
that referenced
this pull request
Oct 11, 2022
Use of the automatic discovery feature was introduced with PR matrix-org#27. The feature is only available in setuptools version 61 and later, though, which this change documents in pyproject.toml. Signed-off-by: Kai A. Hiller <V02460@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While trying to add a Python module at
src/matrix_common/types, I ran into the issue thatpip install -e .would not actually find the new module! This would result in calls totox -e pyto fail as my new module wouldn't be included in the source distribution ofmatrix_common(which tox builds and installs when creating its own virtualenv for testing). My tests needed to import from this new module in order to test it.So, running down the rabbit hole of python packaging I eventually found that our existing
setup.cfgwas not making use of setuptools' autodiscovery features, but instead required manually specifying each package. See the documentation here.Adding my new module to
packagesindeed worked, but as the documentation says, it is tiresome and likely going to confuse new contributors as it did me.This PR removes the
package_dirandpackagesoptions insetup.cfgto allow setuptools to switch to Automatic Discovery mode for packages; specifically the one forsrc-layout.With this, running
pip install -e .allowed mysrc/matrix_common/typesmodule to be discovered and my tests which import the module to pass with when runningtox.Related: #23 (which moved us to a src-based file hierarchy initially).