💥 Update metavar printing#1863
Merged
Merged
Conversation
Contributor
svlandeg
commented
Jul 14, 2026
svlandeg
marked this pull request as ready for review
July 14, 2026 18:46
tiangolo
approved these changes
Jul 15, 2026
tiangolo
left a comment
Member
There was a problem hiding this comment.
Everything looks good! 🙌
This must have been painful to make, going through all the docs. 😅
Thank you!
Member
Author
Quite 😅 Had to do several sections multiple times, too, after making fixes and going back to make sure everything was consistent 🙈 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We've decided to change a bit the "metavar" printing functionality of Typer. In short, the new rules are:
<>for displaying the type (including enum choices etc)[]for displaying something optional in the usage string{}for referencing an object (i.e. not a literal string) in the usage string if neither of the other 2 applyBreaking changes
<>, so"<str>"instead of"TEXT"and"<int>"instead of"INTEGER"etc.<simple|conv|lstm>instead of[simple|conv|lstm]or{simple|conv|lstm>}. Check the new testtest_param_type_help_metavarfor an overview.test_parameter_name_casing.{}, unless they're already surrounded with the "optional" denoting brackets[].master, optional ones were enclosed with[]which felt inconsistent with optional options)Edits in custom.js
When updating the documentation to show e.g.
<str>instead ofTEXT, this would be treated as an HTML tag and not actually displayed in our tutorial pages 😭 Hence the fixes tocustom.js.Tangiantel fixes
Default: Nonein the help text, PR 1120. I updated those as part of the documentation update here. I could also do this in a separate PR if preferred, but it would cause a lot of merge conflicts and duplicate work as I've now been going through all the docs in detail anyway.How to review this PR
Please mostly look at the test/documentation changes, and not so much the actual code changes in the Python files.
The Python edits will become obsolete with the Pydantic refactor that is in the works. In fact, this PR is a "spinoff" of the Pydantic refactor (#1831, WIP) in an attempt to make that one more "reviewable". Only the docs & tests changes will be brought over from here - the code changes from this PR will be subsumed by PR 1831.
AI Disclaimer
Created through pair-programming with Cursor, manually reviewed in detail. Also went through all the Typer docs manually & in detail.
Checklist