Closed
Description
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
python
version: 3.11.2 or 3.8.13django
version: 3.2.18mypy
version: 1.1.1django-stubs
version: 1.16.0django-stubs-ext
version: 0.8.0