mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-09-03 22:29:21 +00:00
Trim runtime ID docs and workflow tests
This commit is contained in:
@@ -363,58 +363,23 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.13.1t"]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
python-version: "3.13"
|
||||
- os: ubuntu-latest
|
||||
python-version: "3.14.0rc2"
|
||||
- os: ubuntu-latest
|
||||
python-version: "3.14.0rc2t"
|
||||
- os: ubuntu-latest
|
||||
python-version: "pypy3.11"
|
||||
steps:
|
||||
- name: Install latest version
|
||||
id: setup-uv
|
||||
uses: $/
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: 3.13.1t
|
||||
activate-environment: true
|
||||
enable-cache: true
|
||||
- name: Verify packages can be installed
|
||||
run: uv pip install pip
|
||||
shell: bash
|
||||
- name: Verify Python version outputs and cache key
|
||||
- name: Verify python version is correct
|
||||
run: |
|
||||
expected_prefix=$(python -I - <<'PY'
|
||||
import platform
|
||||
import sys
|
||||
import sysconfig
|
||||
|
||||
runtime = f"{sys.implementation.name}-{platform.python_version()}"
|
||||
if sysconfig.get_config_var("Py_GIL_DISABLED") == 1:
|
||||
runtime += "+freethreaded"
|
||||
print(f"{runtime}-")
|
||||
PY
|
||||
)
|
||||
case "$PYTHON_RUNTIME_ID" in
|
||||
"$expected_prefix"*) ;;
|
||||
*) echo "Wrong Python runtime ID: $PYTHON_RUNTIME_ID (expected prefix $expected_prefix)"; exit 1 ;;
|
||||
esac
|
||||
if [ "$PYTHON_VERSION" != "$PYTHON_REQUEST" ]; then
|
||||
echo "Wrong requested Python version: $PYTHON_VERSION"
|
||||
python --version
|
||||
if [ "$(python --version)" != "Python 3.13.1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
case "$CACHE_KEY" in
|
||||
*-"$PYTHON_REQUEST"-*) ;;
|
||||
*) echo "Cache key no longer contains requested Python version: $CACHE_KEY"; exit 1 ;;
|
||||
esac
|
||||
shell: bash
|
||||
env:
|
||||
CACHE_KEY: ${{ steps.setup-uv.outputs.cache-key }}
|
||||
PYTHON_REQUEST: ${{ matrix.python-version }}
|
||||
PYTHON_VERSION: ${{ steps.setup-uv.outputs.python-version }}
|
||||
PYTHON_RUNTIME_ID: ${{ steps.setup-uv.outputs.python-runtime-id }}
|
||||
- name: Verify output venv is set
|
||||
run: |
|
||||
if [ -z "$UV_VENV" ]; then
|
||||
|
||||
@@ -138,9 +138,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
|
||||
- `cache-hit`: A boolean value to indicate a cache entry was found.
|
||||
- `venv`: Path to the activated venv if activate-environment is true.
|
||||
- `python-version`: The Python version that was set.
|
||||
- `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime, including
|
||||
implementation, full Python version, and free-threaded build information. Useful as a cache-key component.
|
||||
Empty when `activate-environment` is false. The action fails if the activated runtime cannot be determined.
|
||||
- `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime. Empty when `activate-environment` is false.
|
||||
- `python-cache-hit`: A boolean value to indicate the Python cache entry was found.
|
||||
|
||||
### Python version
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ outputs:
|
||||
python-version:
|
||||
description: "The Python version that was set."
|
||||
python-runtime-id:
|
||||
description: "An opaque identifier reported by uv for the activated venv's Python runtime, including implementation, full Python version, and free-threaded build information. Empty when activate-environment is false. The action fails if the activated runtime cannot be determined."
|
||||
description: "An opaque identifier reported by uv for the activated venv's Python runtime. Empty when activate-environment is false."
|
||||
python-cache-hit:
|
||||
description: "A boolean value to indicate the Python cache entry was found"
|
||||
runs:
|
||||
|
||||
@@ -29,11 +29,6 @@ your cache with `id: setup-uv` on the setup step:
|
||||
key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python-runtime-id }}-${{ hashFiles('uv.lock') }}
|
||||
```
|
||||
|
||||
The free-threaded marker describes the interpreter's build even when the GIL is
|
||||
enabled at runtime. The output is empty when `activate-environment` is false. If
|
||||
the activated runtime cannot be determined, the action fails. The existing
|
||||
`python-version` output and setup-uv's cache keys are unaffected.
|
||||
|
||||
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -10,6 +10,8 @@ export async function getPythonRuntimeId(inputs: SetupInputs): Promise<string> {
|
||||
}
|
||||
|
||||
try {
|
||||
// The venv path restricts results to this invocation's runtime, even if
|
||||
// earlier setup-uv calls installed other Python versions in the same job.
|
||||
const { stdout } = await execFileAsync(
|
||||
"uv",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user