tyro._backends._completion._spec¶
Completion specification format and serialization.
This module defines the JSON-serializable completion spec format used by the embedded Python completion logic in bash/zsh scripts.
Module Contents¶
- class tyro._backends._completion._spec.OptionSpec[source]¶
Bases:
TypedDictSpecification for a single CLI option.
- class tyro._backends._completion._spec.SubcommandSpec[source]¶
Bases:
TypedDictSpecification for a subcommand and its nested structure.
- options: List[OptionSpec]¶
Options available for this subcommand.
- subcommands: Dict[str, SubcommandSpec]¶
Nested subcommands, keyed by name.
- frontier_groups: List[List[str]]¶
Groups of mutually exclusive subcommand choices.
When multiple independent subcommand selections exist at this level (e.g., choosing both a model AND an optimizer), each inner list represents one group of mutually exclusive choices. The completion system uses this to track which groups have been satisfied and which still need selection.
Empty when there’s only one subcommand group (standard subcommands).
- class tyro._backends._completion._spec.CompletionSpec[source]¶
Bases:
TypedDictRoot completion specification for a CLI program.
- options: List[OptionSpec]¶
Top-level options.
- subcommands: Dict[str, SubcommandSpec]¶
Top-level subcommands, keyed by name.
- tyro._backends._completion._spec.build_completion_spec(parser_spec: tyro._parsers.ParserSpecification, prog: str) CompletionSpec[source]¶
Build a completion specification from a ParserSpecification.
- Parameters:
parser_spec (tyro._parsers.ParserSpecification) – Parser specification to convert.
prog (str) – Program name.
- Returns:
Completion spec for the CLI program.
- Return type: