Upgrade to using uv instead of pip #157
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python test / linting | |
| on: | |
| push: | |
| branches: [ "master", "development" ] | |
| paths: | |
| - 'python/**' | |
| - '.github/workflows/python-test.yml' | |
| - '.typos.toml' | |
| - 'ruff.toml' | |
| - '.pre-commit-config.yaml' | |
| pull_request: | |
| branches: [ "master", "development" ] | |
| paths: | |
| - 'python/**' | |
| - '.github/workflows/python-test.yml' | |
| - '.typos.toml' | |
| - 'ruff.toml' | |
| - '.pre-commit-config.yaml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| RUSTFLAGS: -C debuginfo=0 | |
| RUST_BACKTRACE: 1 | |
| PYTHONUTF8: 1 | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| python-test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| run: | | |
| python -m pip install --upgrade uv | |
| - name: Set up Rust | |
| run: rustup show | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: python/pecos-rslib | |
| - name: Generate lockfile and install dependencies | |
| run: | | |
| uv lock --project . | |
| uv sync --project . | |
| - name: Install pecos-rslib with maturin | |
| run: | | |
| cd python/pecos-rslib | |
| uv run maturin develop --uv | |
| - name: Install quantum-pecos | |
| run: | | |
| cd python/quantum-pecos | |
| uv pip install -e . | |
| - name: Run pre-commit checks | |
| run: uv run pre-commit run --all-files --show-diff-on-failure | |
| - name: Install test dependencies | |
| run: | | |
| cd python/quantum-pecos | |
| uv pip install -e .[all,test] # Install with both all and test extras | |
| uv pip install pytest pytest-cov # Explicitly install test requirements | |
| - name: Run standard tests | |
| run: | | |
| uv run pytest ./python/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html | |
| - name: Run optional dependency tests | |
| run: | | |
| uv run pytest ./python/tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html -m optional_dependency |