Add a --system flag for opt-in non-virtualenv installs (#2046)

## Summary

This is essentially a wrapper around something like `--python $(which
python3)`, but gives users a portable and streamlined way to solve the
common pain point of using `uv` in GitHub Actions or a Docker container.

See: https://github.com/astral-sh/uv/issues/1526.
This commit is contained in:
Charlie Marsh
2024-02-28 14:48:32 -05:00
committed by GitHub
parent b873e3e991
commit 9328b3c2ab
8 changed files with 285 additions and 8 deletions

110
.github/workflows/system-install.yml vendored Normal file
View File

@@ -0,0 +1,110 @@
name: System Install
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
jobs:
install-ubuntu:
name: "Install Python on Ubuntu"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: "Install Rust toolchain"
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: "Build"
run: cargo build
- name: "Print Python path"
run: echo $(which python)
- name: "Validate global Python install"
run: python scripts/check_system_python.py --uv ./target/debug/uv
install-macos:
name: "Install Python on macOS"
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: "Install Python"
run: brew install python@3.8
- name: "Install Rust toolchain"
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: "Build"
run: cargo build
- name: "Print Python path"
run: echo $(which python3.11)
- name: "Validate global Python install"
run: python3.11 scripts/check_system_python.py --uv ./target/debug/uv
install-windows:
name: "Install Python on Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# - name: "Install Python"
# run: choco install python
- name: "Install Rust toolchain"
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: "Build"
run: cargo build
- name: "Print Python path"
run: echo $(which python)
- name: "Validate global Python install"
run: py -3.12 ./scripts/check_system_python.py --uv ./target/debug/uv
install-pyenv:
name: "Install Python using pyenv"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install pyenv"
uses: "gabrielfalcao/pyenv-action@v18"
with:
default: 3.9.7
- name: "Install Rust toolchain"
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: "Build"
run: cargo build
- name: "Print Python path"
run: echo $(which python3.9)
- name: "Validate global Python install"
run: python3.9 scripts/check_system_python.py --uv ./target/debug/uv