Skip to content
Discussion options

You must be logged in to vote

Just a quick note for anyone else that I ran into this, and the simplest way I could find to skip an option is the below annotation.

skipped_option = typer.Option(parser=lambda _: _, hidden=True, expose_value=False)

Which you can use as e.g.

def foo(a: int, b: Annotate[str, skipped_option] = 'some default'): ...

This works because

  1. hidden=True - hides it from display in the arg list
  2. expose_value=False - stops any parsed value from being parsed
  3. parser=lambda _: _ - indicates that any value passed to the parser should be maintained.

(The parser argument is the key part missing from the start of this issue).

It would be great to have this as a simpler documented feature - but I'm not sure h…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem investigate
4 participants
Converted from issue

This discussion was converted from issue #506 on September 19, 2025 09:41.