Skip to content

Annotate Authlib introspect_token#15892

Open
popsiclelmlm wants to merge 1 commit into
python:mainfrom
popsiclelmlm:codex/authlib-introspect-token
Open

Annotate Authlib introspect_token#15892
popsiclelmlm wants to merge 1 commit into
python:mainfrom
popsiclelmlm:codex/authlib-introspect-token

Conversation

@popsiclelmlm

Copy link
Copy Markdown
Contributor

Summary

  • Annotate Authlib's introspect_token method so calls are no longer treated as untyped.
  • Add a regression test covering both sync and async httpx OAuth2 clients.

Reproduction

Root cause

  • authlib.oauth2.client.OAuth2Client.introspect_token had no annotations in the stub.
  • The httpx integration subclasses inherit that runtime method; the async variant returns the awaitable produced by AsyncClient.post, while the sync variant returns the response directly.

Changes

  • Add explicit parameter and return annotations to the base Authlib OAuth2 client method.
  • Override the httpx sync/async OAuth2 client signatures to model the sync response vs async awaitable response behavior.
  • Add a regression testcase for introspect_token usage.

Tests

  • PATH=/tmp/typeshed-authlib-introspect-venv/bin:$PATH /tmp/typeshed-authlib-introspect-venv/bin/python tests/runtests.py stubs/Authlib
  • git diff --check

Screenshots/Logs

  • N/A

Closes #15164

@github-actions

Copy link
Copy Markdown
Contributor

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

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Most of these annotations don't look helpful to me. In general, Anys must be documented unless it's obvious why Any is used instead of a specific type. But I'm sure that most of these could be correctly typed.

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.

introspect_token raises no-untyped-call violation in 1.6.6.20251220

2 participants