Option Types

Common types for command line argument specification.

django_typer.types.ForceColor

The type hint for the --force-color option.

The --force-color option is included by default and behaves the same as on BaseCommand use it to force colorization of the command. You can check the supplied value of --force-color by checking the force_color attribute of the command instance.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d8fb0>]

django_typer.types.HideLocals

A toggle to turn off exception traceback local variable rendering in rich tracebacks.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d8e00>]

django_typer.types.NoColor

The type hint for the --no-color option.

The --no-color option is included by default and behaves the same as on BaseCommand use it to force disable colorization of the command. You can check the supplied value of --no-color by checking the no_color attribute of the command instance.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d8ec0>]

django_typer.types.PythonPath

The type hint for the --pythonpath option.

The --pythonpath option is included by default and behaves the same as on BaseCommand use it to specify a directory to add to the Python sys path.

alias of Annotated[Path | None, <typer.models.OptionInfo object at 0x71f3325d8bc0>]

django_typer.types.Settings

The type hint for the --settings option.

The --settings option is included by default and behaves the same as on BaseCommand use it to specify or override the settings module to use.

alias of Annotated[str, <typer.models.OptionInfo object at 0x71f3325d8aa0>]

django_typer.types.ShowLocals

A toggle to turn on exception traceback local variable rendering in rich tracebacks.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d8d40>]

django_typer.types.SkipChecks

The type hint for the --skip-checks option.

The --skip-checks option is included by default and behaves the same as on BaseCommand use it to skip system checks.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d9070>]

django_typer.types.Traceback

The type hint for the --traceback option.

The --traceback option is included by default and behaves the same as on BaseCommand use it to allow CommandError exceptions to propagate out of the command and produce a stack trace.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325d8c80>]

django_typer.types.Verbosity

The type hint for the --verbosity option. TyperCommand does not include the verbosity option by default, but it can be added to the command like so if needed.

from django_typer.types import Verbosity

def handle(self, verbosity: Verbosity = 1):
    ...

alias of Annotated[int, <typer.models.OptionInfo object at 0x71f332543770>]

django_typer.types.Version

The type hint for the --version option.

The --version option is included by default and behaves the same as on BaseCommand.

alias of Annotated[bool, <typer.models.OptionInfo object at 0x71f3325420f0>]

django_typer.types.print_version(context, _, value)[source]

A callback to run the get_version() routine of the command when –version is specified.

django_typer.types.set_force_color(context, _, value)[source]

If the value was provided set it on the command.

django_typer.types.set_no_color(context, _, value)[source]

If the value was provided set it on the command.