Editable installs are broken after `__editable__` and `__path_hook__` changes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Description
I am starting to observe broken editable installs since past week.
Specifically, editable install now creates a __editable__.<pkg>.pth and __editable___<pkg>_finder.py files. These paths are returned as part of namespace.__path__, which has broken a lot of tooling.
pdoc3went broke. Skipping__editable__package seems to fix (hack) it.- We also noticed, namespace packages that installs a CLI are now also broken, because while the binary is under
.venv/bin, it is unable to import the modules since it was installed using-e.- Modifying
PYTHONPATHis the only option.
- Modifying
- We also noticed, due to these changes even VSCode/Pylance is now broken, as it is unable to resolve paths to editable installed packages.
- Adding
"python.analysis.extraPaths"to.vscode/settings.jsonis the way out
- Adding
I was unable to find any search result on Google for __editable__ and __path_hook__. So, I am unsure what I am up against here.
Expected behavior
- Installed CLI from namespace package must work fine without modification of
PYTHONPATH namespace.__path__must return actual path instead of__editable__.*which seems to break a lot of existing tooling
pip version
22.2.2
Python version
3.10.5
OS
MacOS 12.5
How to Reproduce
- Create a namespace package that installs CLI (entry point)
- Install the package with
-e - Installed CLI is broken due to missing
PYTHONPATH
Our projects are using pyproject.toml and setup.cfg.
Output
`ImportError: cannot import name 'entry_point' from 'namespace.cli' (unknown location)`
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the editable install with a namespace package and CLI entry point using pyproject.toml and setup.cfg. Inspect the generated editable..pth and editable__finder.py files, then compare namespace.path and the namespace.cli import behavior. Done means the CLI imports successfully without PYTHONPATH changes and namespace.path exposes usable paths for tooling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100