traceback when not using `django.contrib.auth`
sbdchd opened this issue · 1 comments
sbdchd commented
Bug report
What's wrong
The django-stubs mypy plugin fails when not using django's django.contrib.auth
poetry install
# if we run mypy we get a traceback
❯ poetry run mypy --show-traceback --config-file mypy.ini .
./core/views.py:6: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.761
Traceback (most recent call last):
File "mypy/checker.py", line 399, in accept
File "mypy/nodes.py", line 1062, in accept
File "mypy/checker.py", line 2004, in visit_assignment_stmt
File "mypy/checker.py", line 2046, in check_assignment
File "mypy/checker.py", line 2746, in check_lvalue
File "mypy/checkexpr.py", line 1932, in analyze_ordinary_member_access
File "mypy/checkmember.py", line 126, in analyze_member_access
File "mypy/checkmember.py", line 143, in _analyze_member_access
File "mypy/checkmember.py", line 225, in analyze_instance_member_access
File "mypy/checkmember.py", line 376, in analyze_member_var_access
File "mypy/checkmember.py", line 593, in analyze_var
File "/Users/steve/Downloads/django-attempt/.venv/lib/python3.7/site-packages/mypy_django_plugin/transformers/request.py", line 11, in set_auth_user_model_as_type_for_request_user
model_cls = django_context.apps_registry.get_model(auth_user_model)
File "/Users/steve/Downloads/django-attempt/.venv/lib/python3.7/site-packages/django/apps/registry.py", line 205, in get_model
app_config = self.get_app_config(app_label)
File "/Users/steve/Downloads/django-attempt/.venv/lib/python3.7/site-packages/django/apps/registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'auth'.
./core/views.py:6: : note: use --pdb to drop into pdb
minimal repo: https://github.com/sbdchd/django-stubs-bug-repo
How is that should be
Ideally django-stubs would work when not having the django.contrib.auth
app in INSTALLED_APPS
System information
- OS: Mac OS 10.15
python
version: 3.7.6django
version: 2.2mypy
version: 0.761.0django-stubs
version: 1.4
flaeppe commented
I think this should be closed via #535. As it added these lines:
django-stubs/mypy_django_plugin/transformers/request.py
Lines 10 to 12 in 9874789