-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
setuptools version
65.4.1
Python version
3.10.7
OS
Arch Linux
Additional environment information
No response
Description
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:
[build-system]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"
[project]
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/__init__.py; pip install -e .; touch src/mod2.py; python -c 'import pkg, mod2'This succeeds.
Blow away everything (except for pyproject.toml):
pip uninstall testpkg; rm -rf srcCreate a single (empty) module, editably install, create another (empty) new module; this new module cannot be imported:
mkdir src; touch src/mod1.py; pip install -e .; touch src/mod2.py; python -c 'import mod1, mod2'This fails with ModuleNotFoundError: No module named 'mod2'
Output
See above.