ty check
Check a project for type errors
ty server
Start the language server
ty version
Display ty's version
ty help
Print this message or the help of the given subcommand(s)
PATHS
List of files or directories to check [default: the project root]
36 |--color
whenControl when colored output is used
41 |Possible values:
42 |auto
: Display colors if the output goes to an interactive terminalalways
: Always display colorsnever
: Never display colors--config
, -c
config-optionA TOML <KEY> = <VALUE>
pair (such as you might find in a ty.toml
configuration file)
47 | overriding a specific configuration option.
Overrides of individual settings using this option always take precedence 49 | over all configuration files.
50 |--error
ruleTreat the given rule as having severity 'error'. Can be specified multiple times.
51 |--error-on-warning
Use exit code 1 if there are any warning-level diagnostics
52 |--exit-zero
Always use exit code 0, even when there are error-level diagnostics
53 |--extra-search-path
pathAdditional path to use as a module-resolution source (can be passed multiple times)
54 |--help
, -h
Print help (see a summary with '-h')
55 |--ignore
ruleDisables the rule. Can be specified multiple times.
56 |--output-format
output-formatThe format to use for printing diagnostic messages
57 |Possible values:
58 |full
: Print diagnostics verbosely, with context and helpful hints [default]concise
: Print diagnostics concisely, one per line--project
projectRun the command within the given project directory.
62 |All pyproject.toml
files will be discovered by walking up the directory tree from the given project directory, as will the project's virtual environment (.venv
) unless the venv-path
option is set.
Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
64 |--python
pathPath to the Python environment.
65 |ty uses the Python environment to resolve type information and third-party dependencies.
66 |If not specified, ty will attempt to infer it from the VIRTUAL_ENV
environment variable or discover a .venv
directory in the project root or working directory.
If a path to a Python interpreter is provided, e.g., .venv/bin/python3
, ty will attempt to find an environment two directories up from the interpreter's path, e.g., .venv
. At this time, ty does not invoke the interpreter to determine the location of the environment. This means that ty will not resolve dynamic executables such as a shim.
ty will search in the resolved environments's site-packages
directories for type information and third-party imports.
--python-platform
, --platform
platformTarget platform to assume when resolving types.
70 |This is used to specialize the type of sys.platform
and will affect the visibility of platform-specific functions and attributes. If the value is set to all
, no assumptions are made about the target platform. If unspecified, the current system's platform will be used.
--python-version
, --target-version
versionPython version to assume when resolving types.
72 |The Python version affects allowed syntax, type definitions of the standard library, and type definitions of first- and third-party modules that are conditional on the Python version.
73 |By default, the Python version is inferred as the lower bound of the project's requires-python
field from the pyproject.toml
, if available. Otherwise, the latest stable version supported by ty is used, which is currently 3.13.
ty will not infer the Python version from the Python environment at this time.
75 |Possible values:
76 |3.7
3.8
3.9
3.10
3.11
3.12
3.13
--respect-ignore-files
Respect file exclusions via .gitignore
and other standard ignore files. Use --no-respect-gitignore
to disable
--typeshed
, --custom-typeshed-dir
pathCustom directory to use for stdlib typeshed stubs
86 |--verbose
, -v
Use verbose output (or -vv
and -vvv
for more verbose output)
--warn
ruleTreat the given rule as having severity 'warn'. Can be specified multiple times.
88 |--watch
, -W
Watch files for changes and recheck files related to the changed files
89 |--help
, -h
Print help
104 |--help
, -h
Print help
119 |SHELL
--help
, -h
Print help
138 |__slots__
BaseException
metaclass=
arguments@overload
usagesraise
statements that raise invalid exceptions or use invalid causessuper()
TYPE_CHECKING
constant assignmentssuper()
calls where implicit arguments are unavailable.__bool__
cast
callsreveal_type
without importing itty: ignore
comments that reference unknown rulestype: ignore
comments