Skip to content

Improve authlib/integrations/requests_client/oauth2_session.pyi#15865

Open
noelleleigh wants to merge 6 commits into
python:mainfrom
noelleleigh:authlib/integrations/requests_client/oauth2_session.pyi
Open

Improve authlib/integrations/requests_client/oauth2_session.pyi#15865
noelleleigh wants to merge 6 commits into
python:mainfrom
noelleleigh:authlib/integrations/requests_client/oauth2_session.pyi

Conversation

@noelleleigh

@noelleleigh noelleleigh commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
  • Correct parent classes for OAuth2Auth, OAuth2ClientAuth, and OAuth2Session.
  • Remove comments that are now redundant.
  • Add type annotations to method arguments and return types.
  • Use variable annotations with ClassVar instead of assignments for class variables.

Update 2026-06-08

  • Add types-oauthlib and requests as dependencies of Authlib to pull in their types.
  • Make some types less specific on OAuth2Client to allow subclasses to override them more broadly.

- Correct parent classes for `OAuth2Auth`, `OAuth2ClientAuth`, and
  `OAuth2Session`.
- Remove comments that are now redundant.
- Add type annotations to method arguments and return types.
- Use variable annotations with `ClassVar` instead of assignments for
  class variables.
@github-actions

This comment has been minimized.

@noelleleigh

Copy link
Copy Markdown
Contributor Author

Oh, I guess the stubs from one library can't be used in another one?

stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:6: error: Library stubs not installed for "oauthlib.oauth2"  [import-untyped]
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:6: note: Hint: "python3 -m pip install types-oauthlib"
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:6: note: (or run "mypy --install-types" to install all missing stub packages)
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:6: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:7: error: Library stubs not installed for "requests"  [import-untyped]
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:8: error: Library stubs not installed for "requests.auth"  [import-untyped]
stubs/Authlib/authlib/integrations/requests_client/oauth2_session.pyi:8: note: Hint: "python3 -m pip install types-requests"

error: Signature of "__call__" incompatible with supertype "requests.auth.AuthBase"  [override]
note:      Superclass:
note:          def __call__(self, r: PreparedRequest) -> PreparedRequest
note:      Subclass:
note:          def [_R: Request] __call__(self, req: _R) -> _R
error: Signature of "__call__" incompatible with supertype "requests.auth.AuthBase"  [override]
note:      Superclass:
note:          def __call__(self, r: PreparedRequest) -> PreparedRequest
note:      Subclass:
note:          def [_R: Request] __call__(self, req: _R) -> _R
The signature is different from Session.request
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

1 participant