diff --git a/crates/ty/docs/cli.md b/crates/ty/docs/cli.md index 13465bfb0f..7bf076ee27 100644 --- a/crates/ty/docs/cli.md +++ b/crates/ty/docs/cli.md @@ -67,7 +67,7 @@ over all configuration files.

--project project

Run the command within the given project directory.

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.

-
--python path

Path to the Python environment.

+
--python, --venv path

Path 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_ENV or CONDA_PREFIX environment variables, 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.

diff --git a/crates/ty/docs/environment.md b/crates/ty/docs/environment.md index 12cdf45ea8..29c15b6bd0 100644 --- a/crates/ty/docs/environment.md +++ b/crates/ty/docs/environment.md @@ -42,10 +42,6 @@ Used to determine the name of the active Conda environment. Used to detect the path of an active Conda environment. If both `VIRTUAL_ENV` and `CONDA_PREFIX` are present, `VIRTUAL_ENV` will be preferred. -### `_CONDA_ROOT` - -Used to determine the root install path of Conda. - ### `PYTHONPATH` Adds additional directories to ty's search paths. @@ -68,3 +64,7 @@ Used to detect an activated virtual environment. Path to user-level configuration directory on Unix systems. +### `_CONDA_ROOT` + +Used to determine the root install path of Conda. + diff --git a/crates/ty/src/args.rs b/crates/ty/src/args.rs index 8fac0a343a..45912a67aa 100644 --- a/crates/ty/src/args.rs +++ b/crates/ty/src/args.rs @@ -66,7 +66,7 @@ pub(crate) struct CheckCommand { /// /// ty will search in the resolved environment's `site-packages` directories for type /// information and third-party imports. - #[arg(long, value_name = "PATH")] + #[arg(long, value_name = "PATH", alias = "venv")] pub(crate) python: Option, /// Custom directory to use for stdlib typeshed stubs.