Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New mypy failures on djangorestframework-stubs after django-stubs update #650

Closed
sobolevn opened this issue Aug 12, 2024 · 1 comment · Fixed by #651
Closed

New mypy failures on djangorestframework-stubs after django-stubs update #650

sobolevn opened this issue Aug 12, 2024 · 1 comment · Fixed by #651
Labels
bug Something isn't working

Comments

@sobolevn
Copy link
Member


Run mypy --cache-dir=/dev/null --no-incremental rest_framework-stubs
rest_framework-stubs/authtoken/models.pyi:16: error: Name "pk" already defined (possibly by an import)
rest_framework-stubs/authtoken/models.pyi:17: error: Cannot override writeable attribute with read-only property
rest_framework-stubs/request.pyi:71: error: Signature of "user" incompatible with supertype "HttpRequest"
rest_framework-stubs/request.pyi:71: note:      Superclass:
rest_framework-stubs/request.pyi:71: note:          Union[User, AnonymousUser]
rest_framework-stubs/request.pyi:71: note:      Subclass:
rest_framework-stubs/request.pyi:71: note:          Union[AbstractBaseUser, AnonymousUser]
Found 3 errors in 2 files (checked 68 source files)

cc @flaeppe

Looks like that it fails because of our recent User plugin change.

@sobolevn sobolevn added the bug Something isn't working label Aug 12, 2024
@flaeppe
Copy link
Member

flaeppe commented Aug 13, 2024

Right, yeah, we probably want use the same type of setup here as in django-stubs. I think it'll work to just import and use django.contrib.auth.base_user._UserModel.

I suppose any kind of third party working with the configured user would like to benefit from what we declared as _UserModel, so there might also be a use case to move it to django-stubs-ext and import from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants