diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 1a3d1a9a07ae..68128ea06055 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -256,17 +256,16 @@ pub enum Commands { /// Manage Python versions and installations /// - /// Generally, uv first searches for Python in a virtual environment, either - /// active or in a `.venv` directory in the current working directory or - /// any parent directory. If a virtual environment is not required, uv will - /// then search for a Python interpreter. Python interpreters are found by - /// searching for Python executables in the `PATH` environment variable. + /// Generally, uv first searches for Python in a virtual environment, either active or in a + /// `.venv` directory in the current working directory or any parent directory. If a virtual + /// environment is not required, uv will then search for a Python interpreter. Python + /// interpreters are found by searching for Python executables in the `PATH` environment + /// variable. /// - /// On Windows, the `py` launcher is also invoked to find Python - /// executables. + /// On Windows, the `py` launcher is also invoked to find Python executables. /// - /// By default, uv will download Python if a version cannot be found. This - /// behavior can be disabled with the `--python-downloads` option. + /// By default, uv will download Python if a version cannot be found. This behavior can be + /// disabled with the `--no-python-downloads` flag or the `python-downloads` setting. /// /// The `--python` option allows requesting a different interpreter. /// @@ -278,26 +277,22 @@ pub enum Commands { /// - `@` e.g. `cpython@3.12` /// - `` e.g. `cpython3.12` or `cp312` /// - `` e.g. `cpython>=3.12,<3.13` - /// - `----` e.g. - /// `cpython-3.12.3-macos-aarch64-none` + /// - `----` e.g. `cpython-3.12.3-macos-aarch64-none` /// - /// Additionally, a specific system Python interpreter can often be - /// requested with: + /// Additionally, a specific system Python interpreter can often be requested with: /// /// - `` e.g. `/opt/homebrew/bin/python3` /// - `` e.g. `mypython3` /// - `` e.g. `/some/environment/` /// - /// When the `--python` option is used, normal discovery rules apply but - /// discovered interpreters are checked for compatibility with the request, - /// e.g., if `pypy` is requested, uv will first check if the virtual - /// environment contains a PyPy interpreter then check if each executable in - /// the path is a PyPy interpreter. + /// When the `--python` option is used, normal discovery rules apply but discovered interpreters + /// are checked for compatibility with the request, e.g., if `pypy` is requested, uv will first + /// check if the virtual environment contains a PyPy interpreter then check if each executable + /// in the path is a PyPy interpreter. /// - /// uv supports discovering CPython, PyPy, and GraalPy interpreters. - /// Unsupported interpreters will be skipped during discovery. If an - /// unsupported interpreter implementation is requested, uv will exit with - /// an error. + /// uv supports discovering CPython, PyPy, and GraalPy interpreters. Unsupported interpreters + /// will be skipped during discovery. If an unsupported interpreter implementation is requested, + /// uv will exit with an error. #[clap(verbatim_doc_comment)] #[command( after_help = "Use `uv help python` for more details.", diff --git a/crates/uv/tests/help.rs b/crates/uv/tests/help.rs index a69c5312a6de..961fc5dd9ae4 100644 --- a/crates/uv/tests/help.rs +++ b/crates/uv/tests/help.rs @@ -199,17 +199,16 @@ fn help_subcommand() { ----- stdout ----- Manage Python versions and installations - Generally, uv first searches for Python in a virtual environment, either - active or in a `.venv` directory in the current working directory or - any parent directory. If a virtual environment is not required, uv will - then search for a Python interpreter. Python interpreters are found by - searching for Python executables in the `PATH` environment variable. + Generally, uv first searches for Python in a virtual environment, either active or in a + `.venv` directory in the current working directory or any parent directory. If a virtual + environment is not required, uv will then search for a Python interpreter. Python + interpreters are found by searching for Python executables in the `PATH` environment + variable. - On Windows, the `py` launcher is also invoked to find Python - executables. + On Windows, the `py` launcher is also invoked to find Python executables. - By default, uv will download Python if a version cannot be found. This - behavior can be disabled with the `--python-downloads` option. + By default, uv will download Python if a version cannot be found. This behavior can be + disabled with the `--no-python-downloads` flag or the `python-downloads` setting. The `--python` option allows requesting a different interpreter. @@ -221,26 +220,22 @@ fn help_subcommand() { - `@` e.g. `cpython@3.12` - `` e.g. `cpython3.12` or `cp312` - `` e.g. `cpython>=3.12,<3.13` - - `----` e.g. - `cpython-3.12.3-macos-aarch64-none` + - `----` e.g. `cpython-3.12.3-macos-aarch64-none` - Additionally, a specific system Python interpreter can often be - requested with: + Additionally, a specific system Python interpreter can often be requested with: - `` e.g. `/opt/homebrew/bin/python3` - `` e.g. `mypython3` - `` e.g. `/some/environment/` - When the `--python` option is used, normal discovery rules apply but - discovered interpreters are checked for compatibility with the request, - e.g., if `pypy` is requested, uv will first check if the virtual - environment contains a PyPy interpreter then check if each executable in - the path is a PyPy interpreter. + When the `--python` option is used, normal discovery rules apply but discovered interpreters + are checked for compatibility with the request, e.g., if `pypy` is requested, uv will first + check if the virtual environment contains a PyPy interpreter then check if each executable + in the path is a PyPy interpreter. - uv supports discovering CPython, PyPy, and GraalPy interpreters. - Unsupported interpreters will be skipped during discovery. If an - unsupported interpreter implementation is requested, uv will exit with - an error. + uv supports discovering CPython, PyPy, and GraalPy interpreters. Unsupported interpreters + will be skipped during discovery. If an unsupported interpreter implementation is requested, + uv will exit with an error. Usage: uv python [OPTIONS] diff --git a/docs/concepts/python-versions.md b/docs/concepts/python-versions.md index f7dad4da62fa..70e60a233236 100644 --- a/docs/concepts/python-versions.md +++ b/docs/concepts/python-versions.md @@ -171,8 +171,9 @@ during `uv python install`. !!! tip - The `--python-downloads` option can be passed to any uv command, or it can be set in a - [persistent configuration file](../configuration/files.md) to change the default behavior. + The `python-downloads` setting can be set in a + [persistent configuration file](../configuration/files.md) to change the default behavior, or + the `--no-python-downloads` flag can be passed to any uv command. ## Adjusting Python version preferences diff --git a/docs/reference/cli.md b/docs/reference/cli.md index e377ee147b02..53d8582a2dc0 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -2866,17 +2866,16 @@ uv tool dir [OPTIONS] Manage Python versions and installations -Generally, uv first searches for Python in a virtual environment, either -active or in a `.venv` directory in the current working directory or -any parent directory. If a virtual environment is not required, uv will -then search for a Python interpreter. Python interpreters are found by -searching for Python executables in the `PATH` environment variable. +Generally, uv first searches for Python in a virtual environment, either active or in a +`.venv` directory in the current working directory or any parent directory. If a virtual +environment is not required, uv will then search for a Python interpreter. Python +interpreters are found by searching for Python executables in the `PATH` environment +variable. -On Windows, the `py` launcher is also invoked to find Python -executables. +On Windows, the `py` launcher is also invoked to find Python executables. -By default, uv will download Python if a version cannot be found. This -behavior can be disabled with the `--python-downloads` option. +By default, uv will download Python if a version cannot be found. This behavior can be +disabled with the `--no-python-downloads` flag or the `python-downloads` setting. The `--python` option allows requesting a different interpreter. @@ -2888,26 +2887,22 @@ The following Python version request formats are supported: - `@` e.g. `cpython@3.12` - `` e.g. `cpython3.12` or `cp312` - `` e.g. `cpython>=3.12,<3.13` -- `----` e.g. - `cpython-3.12.3-macos-aarch64-none` +- `----` e.g. `cpython-3.12.3-macos-aarch64-none` -Additionally, a specific system Python interpreter can often be -requested with: +Additionally, a specific system Python interpreter can often be requested with: - `` e.g. `/opt/homebrew/bin/python3` - `` e.g. `mypython3` - `` e.g. `/some/environment/` -When the `--python` option is used, normal discovery rules apply but -discovered interpreters are checked for compatibility with the request, -e.g., if `pypy` is requested, uv will first check if the virtual -environment contains a PyPy interpreter then check if each executable in -the path is a PyPy interpreter. +When the `--python` option is used, normal discovery rules apply but discovered interpreters +are checked for compatibility with the request, e.g., if `pypy` is requested, uv will first +check if the virtual environment contains a PyPy interpreter then check if each executable +in the path is a PyPy interpreter. -uv supports discovering CPython, PyPy, and GraalPy interpreters. -Unsupported interpreters will be skipped during discovery. If an -unsupported interpreter implementation is requested, uv will exit with -an error. +uv supports discovering CPython, PyPy, and GraalPy interpreters. Unsupported interpreters +will be skipped during discovery. If an unsupported interpreter implementation is requested, +uv will exit with an error.

Usage