django-stubs: Crash with latest mypy and django-stubs
Bug report
Error running latest django-stubs.
Traceback (most recent call last):
File "mypy/checkexpr.py", line 4881, in accept
File "mypy/nodes.py", line 1881, in accept
File "mypy/checkexpr.py", line 429, in visit_call_expr
File "mypy/checkexpr.py", line 549, in visit_call_expr_inner
File "mypy/checkexpr.py", line 1209, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 1292, in check_call
File "mypy/checkexpr.py", line 1502, in check_callable_call
File "mypy/checkexpr.py", line 1049, in apply_function_plugin
File "/Users/myuser/.virtualenvs/py311/lib/python3.11/site-packages/mypy_django_plugin/transformers/querysets.py", line 233, in extract_proper_type_queryset_annotate
annotated_type = get_or_create_annotated_type(api, model_type, fields_dict=fields_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/myuser/.virtualenvs/py311/lib/python3.11/site-packages/mypy_django_plugin/transformers/models.py", line 669, in get_or_create_annotated_type
model_module_file = api.modules[model_module_name] # type: ignore
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'django_stubs_ext'
It works using django-stubs==1.7.0 without django-stubs-ext installed.
What’s wrong
Got crash with django-stubs.
How is that should be
It should not crash.
System information
- OS: MacOSX Ventura 12.2
pythonversion: 3.11.2 or 3.8.13djangoversion: 3.2.18mypyversion: 1.1.1django-stubsversion: 1.16.0django-stubs-extversion: 0.8.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (4 by maintainers)
Commits related to this issue
- Try solving missing `django-stubs-ext` module Refs https://github.com/typeddjango/django-stubs/issues/1412 — committed to typeddjango/django-stubs by sobolevn 3 years ago
- Try solving missing `django-stubs-ext` module (#1613) Refs https://github.com/typeddjango/django-stubs/issues/1412 — committed to typeddjango/django-stubs by sobolevn 3 years ago
- fix(mypy): Update the .ini file to avoid crashing while running the command This PR implements the workaround shown in https://github.com/typeddjango/django-stubs/issues/1412#issuecomment-1704706395 — committed to freelawproject/bigcases2 by ERosendo 3 years ago
- fix(mypy): Update the .ini file to avoid crashing This PR implements the workaround shown in https://github.com/typeddjango/django-stubs/issues/1412#issuecomment-1704706395 — committed to freelawproject/bigcases2 by ERosendo 3 years ago
- fix(mypy): Update the .ini file to avoid crashing This PR implements the workaround shown in https://github.com/typeddjango/django-stubs/issues/1412#issuecomment-1704706395 — committed to freelawproject/bigcases2 by ERosendo 3 years ago
- fix(mypy): Update the .ini file to avoid crashing This PR implements the workaround shown in https://github.com/typeddjango/django-stubs/issues/1412#issuecomment-1704706395 — committed to freelawproject/bigcases2 by ERosendo 3 years ago
For me current workaround is to add to mypy.ini: