First Check
Example Code# In a fresh clone of fastapi/typer @ master:
# 1. OptionHelpExtra is defined but referenced nowhere else:
grep -rn "OptionHelpExtra" typer/
# typer/_click/types.py:...:class OptionHelpExtra(TypedDict, total=False):
# (only the definition site)
# 2. The method it annotates in upstream Click does not exist in the vendored copy:
grep -rn "get_help_extra" typer/
# (no matches)
# 3. It is not re-exported from any public surface:
grep -rn "OptionHelpExtra" typer/__init__.py typer/_click/__init__.py
# (no matches; no __all__ lists it)
# 4. TypedDict is imported solely for this type:
grep -rn "TypedDict" typer/
# typer/_click/types.py:...: TypedDict,
# typer/_click/types.py:...:class OptionHelpExtra(TypedDict, total=False):DescriptionOptionHelpExtra in typer/_click/types.py is a TypedDict vendored from Click 8.3.1, where it annotates the return of Option.get_help_extra(). Typer's vendored _click never included that method, and Typer's help-record assembly in typer/core.py doesn't use the type. It's referenced nowhere in the codebase and isn't part of any public API (private _click package, not re-exported, no all entry). I'd like to remove OptionHelpExtra and its now-unused TypedDict import — no runtime or public-API change. Would you be open to a small PR for this? (If Typer later re-vendors Click's get_help_extra() path, the type can be reintroduced with its caller.) Operating SystemWindows Operating System DetailsWindows 10 (verification also reproduces on any OS — this is a static/source-only observation). Project Version0.27.1 (also present on current master, base commit 9a7b2e8) Python Version3.11.4 Additional ContextThe removal was surfaced by an automated dead-code scan and manually verified with the grep checks above. AI-tooling details will be disclosed on the PR itself per the PR template's AI Disclaimer section |
Replies: 2 comments
|
Currently I think a lot is subject to change from the vendored version of Click, hinted from the maintainers, so not sure if they will handle this one differently:
I think some work is already planned ahead here, but that is at least how I see it from my perspective. |
Hi @Vinv-AI! Thanks for the note. Everything in
typer/_clickis currently being refactored, we're working on this internally. Specifically, the entiretyper/_click/types.pymodule will be removed once #1831 is merged.