Skip to content

refactor: remove unused OptionHelpExtra TypedDict from _click.types - #1938

Closed
noQbot wants to merge 1 commit into
fastapi:masterfrom
VinvAI:remove-unused-optionhelpextra
Closed

refactor: remove unused OptionHelpExtra TypedDict from _click.types#1938
noQbot wants to merge 1 commit into
fastapi:masterfrom
VinvAI:remove-unused-optionhelpextra

Conversation

@noQbot

@noQbot noQbot commented Aug 21, 2026

Copy link
Copy Markdown

Pull Request

Discussion: #1937

Description

OptionHelpExtra in typer/_click/types.py is a TypedDict vendored from
Click 8.3.1. In Click it annotates the return value of Option.get_help_extra().
Typer's vendored _click never included that method, and Typer's own help-record
assembly (typer/core.py) does not use the type. As a result OptionHelpExtra
is referenced nowhere in the codebase and is not part of any public API surface:
it lives in the private typer/_click package and is not re-exported by
typer/__init__.py or typer/_click/__init__.py.

This PR:

  • Deletes the unused OptionHelpExtra TypedDict.
  • Removes the now-unused TypedDict import from typer/_click/types.py.

No runtime behavior or public-API change. If Typer later re-vendors Click's
get_help_extra() path, the type can be reintroduced alongside its caller.

AI Disclaimer

Models: Composer 2.5 (via Cursor + VinvAI )

Prompt (paraphrased): act on Vinv's dead-code finding for OptionHelpExtra
confirm the symbol is genuinely unreferenced (no static references, no
re-export from any package __init__ or public API surface, no dynamic lookup
by name, and no get_help_extra caller in Typer's vendored _click), then
delete it along with any now-unused imports or types that existed solely to
support it.

AI transcript
  • Vinv's dead-code sweep flagged OptionHelpExtra in typer/_click/types.py
    as unreferenced; the removal was implemented via Composer 2.5 (Cursor + VinvAI).
  • Independently verified before finalizing:
    • Repo-wide grep for OptionHelpExtra → only the definition site matched.
    • Confirmed get_help_extra (the method it annotates in upstream Click) does
      not exist anywhere in Typer's vendored _click.
    • Confirmed it is not re-exported (typer/__init__.py,
      typer/_click/__init__.py, __all__) and not resolved dynamically.
    • Confirmed the TypedDict import had no other users.
  • Deleted OptionHelpExtra and the now-unused TypedDict import.
  • Ran python -m py_compile typer/_click/types.py → compiles clean. (Full
    pytest/coverage suite not run in this session.)

Checklist

  • This PR links to a GitHub Discussion for the proposed code change.
  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.
  • The documentation explains the change if needed.

OptionHelpExtra (vendored from Click 8.3.1) annotates the return of
Option.get_help_extra(), a method Typer's vendored _click never included.
It is referenced nowhere in the codebase and is not part of any public
API surface. Removing it and its now-unused TypedDict import. No runtime
or public-API change.

Co-Authored-By: Vinv-AI <309466812+Vinv-AI@users.noreply.github.com>

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Closing, violates the guidelines on user contributions.

@svlandeg svlandeg closed this Aug 24, 2026
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.

3 participants