Skip to content
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

[BUG] In editable installs, whether new modules are auto-picked-up depends on whether the distribution contains a package or not #3624

anntzer opened this issue Oct 5, 2022 · 0 comments · Fixed by #3634
bug Needs Triage Issues that need to be evaluated for severity and status.


Copy link

anntzer commented Oct 5, 2022

setuptools version


Python version



Arch Linux

Additional environment information

No response


In a loose (i.e. default) editable install of a distribution containing a single package, adding a toplevel module (out of the package) results in that module being automatically picked up (immediately available for import, without a reinstall). This corresponds also, I believe, to the old, pre-PEP660 behavior.
On the other hand, if the distribution does not contain a package but a single toplevel module, adding another toplevel module results in that (new) module not being automatically picked up.

Expected behavior

Consistent behavior in both cases, hopefully matching the legacy behavior (i.e. new toplevel modules are always auto-picked-up).

How to Reproduce

Write the following pyproject.toml:

requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

name = "testpkg"
version = "0.0.1"

In that directory, create a single package, editably install, create a single (empty) new module, check that the new module can be imported:

mkdir src; mkdir src/pkg; touch src/pkg/; pip install -e .; touch src/; python -c 'import pkg, mod2'

This succeeds.

Blow away everything (except for pyproject.toml):

pip uninstall testpkg; rm -rf src

Create a single (empty) module, editably install, create another (empty) new module; this new module cannot be imported:

mkdir src; touch src/; pip install -e .; touch src/; python -c 'import mod1, mod2'

This fails with ModuleNotFoundError: No module named 'mod2'


See above.

@anntzer anntzer added bug Needs Triage Issues that need to be evaluated for severity and status. labels Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Needs Triage Issues that need to be evaluated for severity and status.
None yet

Successfully merging a pull request may close this issue.

1 participant