tyro._singleton

Module Contents

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

Bases: Singleton, typing_extensions.Any

Type for the tyro.MISSING singleton.

__repr__() str[source]

Return repr(self).

Return type:

str

class tyro._singleton.NonpropagatingMissingType[source]

Bases: Singleton, typing_extensions.Any

Type for the tyro.MISSING_NONPROP singleton.

__repr__() str[source]

Return repr(self).

Return type:

str

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.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.MISSING_AND_MISSING_NONPROP = ()

Singletons that are considered missing values when generating CLI interfaces.

tyro._singleton.EXCLUDE_FROM_CALL

Singleton indicating that an argument should not be passed into a field constructor. This is used for typing.TypedDict.

tyro._singleton.DEFAULT_SENTINEL_SINGLETONS

Singletons that are used as default sentinels when generating CLI interfaces.