Using the pre-commit mypy plugin throws internal library errors
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
Using the pre-commit implementation of mypy throws an INTERNAL ERROR on a project that was previously working. Note that running the same version of mypy from the command line against the same files (in a devcontainer) works as expected.
Pre-commit project can be found at: https://github.com/pre-commit/pre-commit Version 4.3.0
From the pre-commit configuration: running mypy v1.18.2
To Reproduce
Create python project, configure git and install the pre-commit hook
Expected Behavior
Expected to run mypy testing on changed files as usual.
Actual Behavior
vscode ➜ /workspace/internalapi (internalapi_apm_and_logs) $ pre-commit run mypy
mypy.....................................................................Failed
- hook id: mypy
- exit code: 2
/home/vscode/.cache/pre-commit/repo3uyifmwv/py_env-python3.12/lib/python3.12/site-packages/django-stubs/http/request.pyi:56: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.18.2
Traceback (most recent call last):
File "mypy/semanal.py", line 7350, in accept
File "mypy/nodes.py", line 1624, in accept
File "mypy/semanal.py", line 3272, in visit_assignment_stmt
File "mypy/semanal.py", line 3806, in process_type_annotation
File "mypy/semanal.py", line 6996, in defer
AssertionError: Must not defer during final iteration
/home/vscode/.cache/pre-commit/repo3uyifmwv/py_env-python3.12/lib/python3.12/site-packages/django-stubs/http/request.pyi:56: : note: use --pdb to drop into pdb
Your Environment
- Mypy version used: 1.18.2
- Mypy command-line flags: --show-traceback, --check-untyped-defs, --ignore-missing-imports, --config-file=pyproject.toml
- Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.12
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 problema con pre-commit run mypy usando Python 3.12, mypy 1.18.2 e i flag elencati, quindi confrontalo con l’invocazione dalla riga di comando. Inizia dal traceback dell’analizzatore semantico in mypy/semanal.py e dall’annotazione in django-stubs/http/request.pyi:56. Il lavoro è completato quando l’hook pre-commit termina senza l’INTERNAL ERROR durante il controllo degli stessi file.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100