Update the interface for declaring Python download preferences (#5936)

The loose consensus is that "fetch" doesn't have much meaning and that a
boolean flag makes more sense from the command line.

1. Adds `--allow-python-downloads` (hidden, default) and
`--no-python-downloads` to the CLI to quickly enable or disable
downloads
2. Deprecates `--python-fetch` in favor of the options from (1)
3. Removes  `python-fetch` in favor of a `python-downloads` setting
5. Adds a `never` variant to the enum, allowing even explicit installs
to be disabled via the configuration file

## Test plan

I tested this with various `pyproject.toml`-level settings and `uv venv
--preview --python 3.12.2` and `uv python install 3.12.2` with and
without the new CLI flags.
This commit is contained in:
Zanie Blue
2024-08-09 13:10:19 -05:00
committed by GitHub
parent a129cf7d7e
commit 4df0fe9a01
28 changed files with 266 additions and 488 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ Additionally, a specific system Python interpreter can be requested with:
By default, uv will automatically download Python versions if they cannot be found on the system.
This behavior can be
[disabled with the `python-fetch` option](#disabling-automatic-python-downloads).
[disabled with the `python-downloads` option](#disabling-automatic-python-downloads).
## Installing a Python version
@@ -155,7 +155,7 @@ version download.
By default, uv will automatically download Python versions when needed.
The `python-fetch` option can be used to disable this behavior. By default, it is set to
The `python-downloads` option can be used to disable this behavior. By default, it is set to
`automatic`; set to `manual` to only allow Python downloads during `uv python install`.
## Adjusting Python version preferences