mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-10-07 11:57:15 +00:00
Add python-arch support (#1079)
Windows ARM64 jobs may need x64 Python independently of their Python version pin. Add `python-arch` to export `UV_PYTHON_ARCH` for subsequent steps and include the selected architecture in the uv and managed-Python cache keys. The input takes precedence over an inherited environment value, and unsupported uv versions fail before environment creation. Requires a uv release with `UV_PYTHON_ARCH` support.
This commit is contained in:
1 parent
c84232ca4f
commit
b06acff4b6
15 files changed
+431
-15
No files matched your search
@@ -15,6 +15,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
||||
- [Inputs](#inputs)
|
||||
- [Outputs](#outputs)
|
||||
- [Python version](#python-version)
|
||||
- [Python architecture](#python-architecture)
|
||||
- [Working directory](#working-directory)
|
||||
- [Advanced Configuration](#advanced-configuration)
|
||||
- [How it works](#how-it-works)
|
||||
@@ -56,6 +57,9 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
# The version of Python to set UV_PYTHON to (overrides the Python version from .tool-versions)
|
||||
python-version: ""
|
||||
|
||||
# The Python architecture to set UV_PYTHON_ARCH to, e.g., x86_64 or aarch64
|
||||
python-arch: ""
|
||||
|
||||
# Use uv venv to activate a venv ready to be used by later steps
|
||||
activate-environment: "false"
|
||||
|
||||
@@ -193,6 +197,25 @@ jobs:
|
||||
run: uv run --frozen pytest
|
||||
```
|
||||
|
||||
### Python architecture
|
||||
|
||||
Use `python-arch` to set `UV_PYTHON_ARCH` for the rest of the job. This selects the Python
|
||||
architecture independently of the version, including versions requested by `.python-version`.
|
||||
An explicit architecture or interpreter path in a Python request takes precedence.
|
||||
|
||||
```yaml
|
||||
- uses: astral-sh/setup-uv@main
|
||||
with:
|
||||
python-version: "3.14"
|
||||
python-arch: x86_64
|
||||
- run: uv run --frozen pytest
|
||||
```
|
||||
|
||||
The input overrides an existing `UV_PYTHON_ARCH` value. When it is omitted, the action respects
|
||||
`UV_PYTHON_ARCH` from the environment. Both forms require a uv version that supports the variable;
|
||||
the action reports an error if the installed version does not support it. The selected architecture
|
||||
is included in the [cache key](docs/caching.md#cache-key).
|
||||
|
||||
### Working directory
|
||||
|
||||
You can set the working directory with the `working-directory` input.
|
||||
|
||||
Reference in new issue
Block a user