8.2 KiB
Generated
CLI Reference
ty
An extremely fast Python type checker.
Usage
ty <COMMAND>
Commands
ty checkCheck a project for type errors
ty serverStart the language server
ty versionDisplay ty's version
ty helpPrint this message or the help of the given subcommand(s)
ty check
Check a project for type errors
Usage
ty check [OPTIONS] [PATH]...
Arguments
PATHSList of files or directories to check [default: the project root]
Options
--colorwhenControl when colored output is used
Possible values:
auto: Display colors if the output goes to an interactive terminalalways: Always display colorsnever: Never display colors
--config,-cconfig-optionA TOML
<KEY> = <VALUE>pair--errorruleTreat the given rule as having severity 'error'. Can be specified multiple times.
--error-on-warningUse exit code 1 if there are any warning-level diagnostics
--exit-zeroAlways use exit code 0, even when there are error-level diagnostics
--extra-search-pathpathAdditional path to use as a module-resolution source (can be passed multiple times)
--help,-hPrint help (see a summary with '-h')
--ignoreruleDisables the rule. Can be specified multiple times.
--output-formatoutput-formatThe format to use for printing diagnostic messages
Possible values:
full: Print diagnostics verbosely, with context and helpful hints [default]concise: Print diagnostics concisely, one per line
--projectprojectRun the command within the given project directory.
All
pyproject.tomlfiles will be discovered by walking up the directory tree from the given project directory, as will the project's virtual environment (.venv) unless thevenv-pathoption is set.Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
--pythonpathPath to the Python environment.
ty uses the Python environment to resolve type information and third-party dependencies.
If not specified, ty will attempt to infer it from the
VIRTUAL_ENVenvironment variable or discover a.venvdirectory 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-packagesdirectories for type information and third-party imports.--python-platform,--platformplatformTarget platform to assume when resolving types.
This is used to specialize the type of
sys.platformand will affect the visibility of platform-specific functions and attributes. If the value is set toall, no assumptions are made about the target platform. If unspecified, the current system's platform will be used.--python-version,--target-versionversionPython version to assume when resolving types.
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.
By default, the Python version is inferred as the lower bound of the project's
requires-pythonfield from thepyproject.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.
Possible values:
3.73.83.93.103.113.123.13
--respect-ignore-filesRespect file exclusions via
.gitignoreand other standard ignore files. Use--no-respect-gitignoreto disable--typeshed,--custom-typeshed-dirpathCustom directory to use for stdlib typeshed stubs
--verbose,-vUse verbose output (or
-vvand-vvvfor more verbose output)--warnruleTreat the given rule as having severity 'warn'. Can be specified multiple times.
--watch,-WWatch files for changes and recheck files related to the changed files
ty server
Start the language server
Usage
ty server
Options
--help,-hPrint help
ty version
Display ty's version
Usage
ty version
Options
--help,-hPrint help
ty generate-shell-completion
Generate shell completion
Usage
ty generate-shell-completion <SHELL>
Arguments
Options
--help,-hPrint help
ty help
Print this message or the help of the given subcommand(s)
Usage
ty help [COMMAND]