Skip to content

fix: label unannotated type variables as typevars - #415

Merged
has2k1 merged 1 commit into
mainfrom
typevar-label
Oct 23, 2026
Merged

has2k1 merged 1 commit into
mainfrom
typevar-label

Conversation

@has2k1

@has2k1 has2k1 commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

This PR gives a type variable declared without an annotation, such as T = TypeVar("T"), a typevar badge on its reference page. The label was read only from the annotation, so the usual spelling showed constant, and the stylesheet had no colour or text for a typevar badge. ParamSpec, TypeVarTuple and the typing.TypeVar spellings get the badge too.

Before:

Reference page for a TypeVar with a constant badge

After:

Reference page for a TypeVar with a purple typevar badge

A type variable declared as `T = TypeVar("T")`, the usual spelling, was
badged as a constant because only its annotation was inspected. The
declared value now decides, and `ParamSpec` and `TypeVarTuple` count
too, so the typing page also lists them under Type Variables. The
typevar badge gains its text and a colour of its own; it previously
rendered empty.
@github-actions

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 39947242659

# or always the latest build for this PR
great-docs preview --pr 415
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@has2k1
has2k1 merged commit 7d9f98c into main Oct 23, 2026
8 checks passed
@has2k1
has2k1 deleted the typevar-label branch October 23, 2026 15:15
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