tyro._singleton

Module Contents

class tyro._singleton.Singleton[source]
init(*args, **kwds)[source]
class tyro._singleton.PropagatingMissingType[source]

Bases: Singleton

class tyro._singleton.NonpropagatingMissingType[source]

Bases: Singleton

class tyro._singleton.ExcludeFromCallType[source]

Bases: Singleton

class tyro._singleton.NotRequiredButWeDontKnowTheValueType[source]

Bases: Singleton

tyro._singleton.MISSING: Any

Sentinel value to mark default values as missing. Can be used to mark fields passed in via default= for tyro.cli() as required.

When used, the ‘missing’ semantics propagate to children. For example, if we write:

def main(inner: Dataclass = tyro.MISSING) -> None:
    ...

tyro.cli(main)

then all fields belonging to Dataclass will be marked as missing, even if a default exists in the dataclass definition.

tyro._singleton.MISSING_NONPROP: Any

Non-propagating version of tyro.MISSING.

When used, the ‘missing’ semantics do not propagate to children. For example:

def main(inner: Dataclass = tyro.constructors.MISSING_NONPROP) -> None:
    ...

tyro.cli(main)

is equivalent to:

def main(inner: Dataclass) -> None:
    ...

tyro.cli(main)

where default values for fields belonging to Dataclass will be taken from the dataclass definition.

tyro._singleton.NOT_REQUIRED_BUT_WE_DONT_KNOW_THE_VALUE
tyro._singleton.EXCLUDE_FROM_CALL
tyro._singleton.MISSING_AND_MISSING_NONPROP = ()

Singletons that are considered missing values when generating CLI interfaces.

tyro._singleton.DEFAULT_SENTINEL_SINGLETONS