Due to limitation, static analysis don't support import hook used in editable install v64+
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
setuptools==64.0.2
Python version
3.10
OS
macOS, Linux
Additional environment information
No response
Description
After installing editable packages (with a pyproject.toml) with setuptools >=64, mypy is no longer able to find the py.typed files when checking a codebase importing/referencing the editable installed package.
This was opened as a mypy issue in https://github.com/python/mypy/issues/13392, but they recommended we open an issue here. I'm guessing there will be some further discussion on both sides, but just getting the ball rolling.
Expected behavior
Editable installs are still discoverable by static type checkers.
How to Reproduce
See the README in https://github.com/JacobHayes/editable-install-hooks-repro
Output
$ mypy --namespace-packages --explicit-package-bases src
src/org/pkg2/__init__.py:1: error: Cannot find implementation or library stub for module named "org.pkg1"
src/org/pkg2/__init__.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
$ pylint src/
************* Module org.pkg2
src/org/pkg2/__init__.py:2:0: E0611: No name 'pkg1' in module 'org' (no-name-in-module)
-----------------------------------
Your code has been rated at 0.00/10
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 with the README in the linked editable-install-hooks-repro repository and reproduce the issue using setuptools 64.0.2, Python 3.10, and the shown mypy and pylint commands. Inspect how the editable install exposes org.pkg1 and determine what must change so static type checkers find its py.typed files; done means the missing-import and no-name-in-module errors no longer occur.
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
- Mostly clear
- Newbie friendliness
- 35/100