-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for setuptools to automatically discover new modules under src/matrix_common
#27
Conversation
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 |
3.6 is end of life. Let's drop it. (https://endoflife.date/python) |
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
Python 3.6 dropped in #28. CI passes against Python 3.7+ 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems plausible
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.
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>
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>
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 py
to 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.cfg
was not making use of setuptools' autodiscovery features, but instead required manually specifying each package. See the documentation here.Adding my new module to
packages
indeed 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_dir
andpackages
options insetup.cfg
to 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/types
module 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).