Unintuitive behaviour when only subpackage provides py.typed
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug Report
from numba import typed causes mypy to generate spurious attr-defined errors for everything else imported from numba.
To Reproduce
from numba import njit, typed # error: Module has no attribute "njit" [attr-defined]
Expected Behavior
scratch.py:1: error: Skipping analyzing "numba": module is installed, but missing library stubs or py.typed marker [import]
scratch.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Actual Behavior
scratch.py:1: error: Module "numba" has no attribute "njit" [attr-defined]
Your Environment
- Mypy version used: 1.5.1
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini(and other config files): none - Python version used: 3.8.8, 3.10.9, 3.11.5
$ .venv/bin/pip freeze
importlib-metadata==6.8.0
llvmlite==0.40.1
mypy==1.5.1
mypy-extensions==1.0.0
numba==0.57.1
numpy==1.24.4
tomli==2.0.1
typing_extensions==4.8.0
zipp==3.17.0
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il report con l’import scratch.py mostrato e le versioni indicate di mypy, Python e numba. Inizia tracciando il modo in cui mypy gestisce i pacchetti installati quando solo un sottopacchetto fornisce py.typed; il lavoro è completato quando l’import non produce più l’errore spurio attr-defined e un test di regressione copre questa disposizione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- compilers, devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100