Skip to content

ty

ty documentation

toolroom._stubs.ty.Ty

Bases: Tool[_R]

Check

Bases: Tool[_R2]

__call__

__call__(
    *args: str | PathLike[str],
    add_ignore: Flag = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    config_file: Value = ...,
    error: Value = ...,
    error_on_warning: Flag = ...,
    exclude: Value = ...,
    exclude_scripts: Flag = ...,
    exit_zero: Flag = ...,
    exit_zero_on_warning: Flag = ...,
    extra_search_path: Value = ...,
    fix: Flag = ...,
    force_exclude: Flag = ...,
    ignore: Value = ...,
    no_progress: Flag = ...,
    output_format: OutputFormat
    | Sequence[OutputFormat]
    | None = ...,
    project: Value = ...,
    python: Value = ...,
    python_platform: Value = ...,
    python_version: PythonVersion
    | Sequence[PythonVersion]
    | None = ...,
    quiet: Flag = ...,
    respect_ignore_files: Flag = ...,
    typeshed: Value = ...,
    verbose: Flag = ...,
    warn: Value = ...,
    watch: Flag = ...,
    **flags: Any,
) -> _R2

Check a project for type errors

Parameters:

Name Type Description Default
add_ignore Flag

Adds ty: ignore comments to suppress all rule diagnostics.

...
color Color | Sequence[Color] | 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.

...
exclude_scripts Flag

Exclude files containing PEP 723 inline script metadata unless passed explicitly. exclude_scripts=off emits --include-scripts. Added in 0.0.64.

...
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 OutputFormat | Sequence[OutputFormat] | 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 PythonVersion | Sequence[PythonVersion] | 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.

...

__call__

__call__(*args: str | PathLike[str], **flags: Any) -> _R

An extremely fast Python type checker.

flags

flags(**flags: Any) -> Self

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.