-
Notifications
You must be signed in to change notification settings - Fork 472
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
Python standard library Modulefinder not working with editable installed packages #1077
Comments
This issue seems to be related to how Python's In Python, an editable install (pip install -e) creates a link in your site-packages directory to your project's source code directory. This allows you to make changes to your package without having to reinstall it. However, modulefinder might not be able to find these packages because it's looking for actual package files, not links. The error message AttributeError: 'NoneType' object has no attribute 'is_package' suggests that modulefinder is trying to call the is_package method on a None object, which likely means it couldn't find the package you're trying to import. As a workaround, you could try to install the package normally (without -e) before running modulefinder. If you need to make changes to the package, you can reinstall it after making your changes. If this doesn't work, you might want to consider using a different tool for finding modules, or filing a bug report with the Python team. |
Hello,
This is related to the Python images: https://github.com/devcontainers/images/tree/main/src/python
When having a Python package installed as editable (pip install -e ...) the standard library Modulefinder cannot find the package.
See also: thebjorn/pydeps#222
I'll try to recap/provide a how-to-reproduce:
pip install -e mypackage
echo "import mypackage" > test.py
python test.py
(should not throw import errors)This does not occur when using the Debian provided Python version.
In the latest version that I've tested (3.12-bookworm) this also does not occur when installing the package normally.
In a previous version however (3.11-bullseye) installing it normally threw a stacktrace, ending in:
The text was updated successfully, but these errors were encountered: