Skip to content

feat: Various typing improvements #890

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

khvn26
Copy link

@khvn26 khvn26 commented Mar 13, 2025

  • Resorted to using virtual subclassing instead of a current TypeVar for the AuthToken/AbstractBaseUser covariant type as it doesn't seem to play nice with Mypy.
  • Added virtual subclassing to the mixin. Current Generic usage seems plain wrong.
  • Added if TYPE_CHECKING: assert self.user assertions to TokenObtainSerializer implementations to make Mypy understand the serializer lifecycle.
  • Added type-checking assertion for lifetime in Token.set_exp.
  • Other minor improvements.

@khvn26 khvn26 changed the title fix: Various typing improvements feat: Various typing improvements Mar 13, 2025
@vgrozdanic
Copy link
Contributor

Thank you for your contribution!

I see that a lot of tests are failing, python 3.9 which we still support doesn't have some of the typing attributes available (e.g. TypeAlias).

Can you please make this PR compatible with python versions 3.9 - 3.13?


class TokenUser:
class TokenUser(TokenUserBase):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this being introduced?

Is there a reason why TokenUser should be a subclass of AbstractBaseUser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants