Skip to content

ty

ty documentation

footman._stubs.ty.Ty

Bases: Tool

__call__

__call__(*args: str, **flags: Any) -> Result

An extremely fast Python type checker.

check

check(
    *args: str,
    add_ignore: _Flag = ...,
    color: Literal["auto", "always", "never"]
    | Sequence[Literal["auto", "always", "never"]]
    | None = ...,
    config: _Value = ...,
    config_file: _Value = ...,
    error: _Value = ...,
    error_on_warning: _Flag = ...,
    exclude: _Value = ...,
    exit_zero: _Flag = ...,
    exit_zero_on_warning: _Flag = ...,
    extra_search_path: _Value = ...,
    fix: _Flag = ...,
    force_exclude: _Flag = ...,
    ignore: _Value = ...,
    no_progress: _Flag = ...,
    output_format: Literal[
        "full", "concise", "gitlab", "github", "junit"
    ]
    | Sequence[
        Literal[
            "full", "concise", "gitlab", "github", "junit"
        ]
    ]
    | None = ...,
    project: _Value = ...,
    python: _Value = ...,
    python_platform: _Value = ...,
    python_version: Literal[
        "3.7",
        "3.8",
        "3.9",
        "3.10",
        "3.11",
        "3.12",
        "3.13",
        "3.14",
        "3.15",
    ]
    | Sequence[
        Literal[
            "3.7",
            "3.8",
            "3.9",
            "3.10",
            "3.11",
            "3.12",
            "3.13",
            "3.14",
            "3.15",
        ]
    ]
    | None = ...,
    quiet: _Flag = ...,
    respect_ignore_files: _Flag = ...,
    typeshed: _Value = ...,
    verbose: _Flag = ...,
    warn: _Value = ...,
    watch: _Flag = ...,
    **flags: Any,
) -> Result

Check a project for type errors

Parameters:

Name Type Description Default
add_ignore _Flag

Adds ty: ignore comments to suppress all rule diagnostics.

...
color Literal['auto', 'always', 'never'] | Sequence[Literal['auto', 'always', 'never']] | None

Control when colored output is used.

...
config _Value

A TOML <KEY> = <VALUE> pair (such as you might find in a ty.toml configuration file) overriding a specific configuration option.

...
config_file _Value

The path to a ty.toml file to use for configuration.

...
error _Value

Treat the given rule as having severity 'error'. May be repeated: a list emits the flag once per item.

...
error_on_warning _Flag

Use exit code 1 if there are any warning-level diagnostics.

...
exclude _Value

Glob patterns for files to exclude from type checking.

...
exit_zero _Flag

Always use exit code 0, even when there are error-level diagnostics.

...
exit_zero_on_warning _Flag

Use exit code 0 if there are no error-level diagnostics.

...
extra_search_path _Value

Additional path to use as a module-resolution source (can be passed multiple times). May be repeated: a list emits the flag once per item.

...
fix _Flag

Apply fixes to resolve errors.

...
force_exclude _Flag

Enforce exclusions, even for paths passed to ty directly on the command-line. force_exclude=off emits --no-force-exclude.

...
ignore _Value

Disables the rule. May be repeated: a list emits the flag once per item.

...
no_progress _Flag

Hide all progress outputs.

...
output_format Literal['full', 'concise', 'gitlab', 'github', 'junit'] | Sequence[Literal['full', 'concise', 'gitlab', 'github', 'junit']] | None

The format to use for printing diagnostic messages.

...
project _Value

Run the command within the given project directory.

...
python _Value

Path to your project's Python environment or interpreter.

...
python_platform _Value

Target platform to assume when resolving types.

...
python_version Literal['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] | Sequence[Literal['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15']] | None

Python version to assume when resolving types.

...
quiet _Flag

Use quiet output (or -qq for silent output).

...
respect_ignore_files _Flag

Respect file exclusions via .gitignore and other standard ignore files. respect_ignore_files=off emits --no-respect-ignore-files.

...
typeshed _Value

Custom directory to use for stdlib typeshed stubs.

...
verbose _Flag

Use verbose output (or -vv and -vvv for more verbose output).

...
warn _Value

Treat the given rule as having severity 'warn'. May be repeated: a list emits the flag once per item.

...
watch _Flag

Watch files for changes and recheck files related to the changed files.

...

flags

flags(**flags: Any) -> Ty

Bind tool-level global options before the subcommand.

tools.docker.flags(host=...) puts a tool's own options ahead of the verb, where they belong.