Using the pre-commit mypy plugin throws internal library errors
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 20.6k
- Forks
- 3.3k
- Métriques de merge des PR
- Métriques de PR en attente
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez l’échec avec pre-commit run mypy en utilisant Python 3.12, mypy 1.18.2 et les flags indiqués, puis comparez-le à l’invocation en ligne de commande. Commencez par la traceback de l’analyseur sémantique dans mypy/semanal.py et l’annotation de django-stubs/http/request.pyi:56. Le travail est terminé lorsque le hook pre-commit s’exécute jusqu’au bout sans l’INTERNAL ERROR lors de la vérification des mêmes fichiers.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100