Make Python and PyPy install mirrors configurable in uv.toml (#8695)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) --> ## Summary Adds python-install-mirror and pypy-install-mirror as keys for uv.toml, and cli args for `uv python install`. Could leave the cli args out if we think the env vars and configs are sufficient. Fixes #8186 <!-- What's the purpose of the change? What does it do, and why? --> --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
@@ -4457,6 +4457,13 @@ uv python install [OPTIONS] [TARGETS]...
|
||||
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--mirror</code> <i>mirror</i></dt><dd><p>Set the URL to use as the source for downloading Python installations.</p>
|
||||
|
||||
<p>The provided URL will replace <code>https://github.com/indygreg/python-build-standalone/releases/download</code> in, e.g., <code>https://github.com/indygreg/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz</code>.</p>
|
||||
|
||||
<p>Distributions can be read from a local directory by using the <code>file://</code> URL scheme.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_PYTHON_INSTALL_MIRROR</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
@@ -4493,6 +4500,13 @@ uv python install [OPTIONS] [TARGETS]...
|
||||
|
||||
<p>This setting has no effect when used in the <code>uv pip</code> interface.</p>
|
||||
|
||||
</dd><dt><code>--pypy-mirror</code> <i>pypy-mirror</i></dt><dd><p>Set the URL to use as the source for downloading PyPy installations.</p>
|
||||
|
||||
<p>The provided URL will replace <code>https://downloads.python.org/pypy</code> in, e.g., <code>https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2</code>.</p>
|
||||
|
||||
<p>Distributions can be read from a local directory by using the <code>file://</code> URL scheme.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_PYPY_INSTALL_MIRROR</code> environment variable.</p>
|
||||
</dd><dt><code>--python-preference</code> <i>python-preference</i></dt><dd><p>Whether to prefer uv-managed or system Python installations.</p>
|
||||
|
||||
<p>By default, uv prefers using Python versions it manages. However, it will use system Python installations if a uv-managed Python is not installed. This option allows prioritizing or ignoring system Python installations.</p>
|
||||
|
||||
@@ -1226,6 +1226,37 @@ The URL for publishing packages to the Python package index (by default:
|
||||
|
||||
---
|
||||
|
||||
### [`pypy-install-mirror`](#pypy-install-mirror) {: #pypy-install-mirror }
|
||||
|
||||
Mirror URL to use for downloading managed PyPy installations.
|
||||
|
||||
By default, managed PyPy installations are downloaded from [downloads.python.org](https://downloads.python.org/).
|
||||
This variable can be set to a mirror URL to use a different source for PyPy installations.
|
||||
The provided URL will replace `https://downloads.python.org/pypy` in, e.g., `https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2`.
|
||||
|
||||
Distributions can be read from a
|
||||
local directory by using the `file://` URL scheme.
|
||||
|
||||
**Default value**: `None`
|
||||
|
||||
**Type**: `str`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
=== "pyproject.toml"
|
||||
|
||||
```toml
|
||||
[tool.uv]
|
||||
pypy-install-mirror = "https://downloads.python.org/pypy"
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
pypy-install-mirror = "https://downloads.python.org/pypy"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### [`python-downloads`](#python-downloads) {: #python-downloads }
|
||||
|
||||
Whether to allow Python downloads.
|
||||
@@ -1254,6 +1285,36 @@ Whether to allow Python downloads.
|
||||
|
||||
---
|
||||
|
||||
### [`python-install-mirror`](#python-install-mirror) {: #python-install-mirror }
|
||||
|
||||
Mirror URL for downloading managed Python installations.
|
||||
|
||||
By default, managed Python installations are downloaded from [`python-build-standalone`](https://github.com/indygreg/python-build-standalone).
|
||||
This variable can be set to a mirror URL to use a different source for Python installations.
|
||||
The provided URL will replace `https://github.com/indygreg/python-build-standalone/releases/download` in, e.g., `https://github.com/indygreg/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz`.
|
||||
|
||||
Distributions can be read from a local directory by using the `file://` URL scheme.
|
||||
|
||||
**Default value**: `None`
|
||||
|
||||
**Type**: `str`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
=== "pyproject.toml"
|
||||
|
||||
```toml
|
||||
[tool.uv]
|
||||
python-install-mirror = "https://github.com/indygreg/python-build-standalone/releases/download"
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
python-install-mirror = "https://github.com/indygreg/python-build-standalone/releases/download"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### [`python-preference`](#python-preference) {: #python-preference }
|
||||
|
||||
Whether to prefer using Python installations that are already present on the system, or
|
||||
|
||||
Reference in New Issue
Block a user