In pull request workflow (PriorLabs/tabpfn-client)
The In pull request workflow from PriorLabs/tabpfn-client, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the In pull request workflow from the PriorLabs/tabpfn-client repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: In pull request
on:
pull_request:
concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true
jobs:
test_compatibility:
name: Test Package Compatibility
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
dependency-set: minimum
- os: macos-15-intel # We need x86 as ARM is python>= 3.11 only.
# https://github.com/actions/setup-python/issues/855
python-version: "3.10"
dependency-set: minimum
- os: ubuntu-latest
python-version: "3.13"
dependency-set: maximum
- os: macos-latest
python-version: "3.13"
dependency-set: maximum
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install workflow Python deps
run: python -m pip install pip-tools tomli
- name: Generate requirements file for minimum dependencies
if: matrix.dependency-set == 'minimum'
run: python scripts/gen_requirements.py min requirements-generated.txt
- name: Generate requirements file for maximum dependencies
if: matrix.dependency-set == 'maximum'
run: python scripts/gen_requirements.py max requirements-generated.txt
- name: Generate requirements file for dev dependencies
run: python scripts/gen_requirements.py --dev passthrough dev-requirements-generated.txt
# Caching based on dependency set and python version. It needs to be done post any operations that modifies the file (like `write`, `touch`, etc.) that can change the hash of the dependency file and lead to a cache miss.
# REFER: https://github.com/actions/setup-python#caching-packages-dependencies
- name: Setup pip cache
id: pip-cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.dependency-set }}-${{ hashFiles('pyproject.toml', 'requirements-generated.txt', 'dev-requirements-generated.txt')}}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.dependency-set }}-
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install dependencies
id: install-deps
run: |
echo "::group::Installing dependencies"
START_TIME=$(date +%s%N)
python -m pip install --upgrade pip
pip install -e . --no-deps
pip install -r requirements-generated.txt
pip install -r dev-requirements-generated.txt
END_TIME=$(date +%s%N)
DURATION=$((($END_TIME - $START_TIME)/1000000))
echo "duration=$DURATION" >> $GITHUB_OUTPUT
echo "Dependencies installation took $DURATION ms"
echo "::endgroup::"
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Check for forbidden licenses
if: runner.os == 'macOS' && matrix.python-version == '3.10'
run: |
licensecheck \
--requirements-paths pyproject.toml \
--only-licenses APACHE MIT BSD ISC PYTHON ZLIB UNLICENSE UNKNOWN \
--ignore-packages certifi "tabpfn*" \
--show-only-failing \
-0
- name: Report cache status
run: |
echo "Cache status: ${{ steps.pip-cache.outputs.cache-hit == 'true' && 'HIT' || 'MISS'}}"
echo "Installation time: ${{ steps.install-deps.outputs.duration }} ms"
- name: Run Tests
run: |
pytest
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: In pull request on: pull_request: concurrency: group: pr-${{ github.ref }} cancel-in-progress: true jobs: test_compatibility: timeout-minutes: 30 name: Test Package Compatibility strategy: fail-fast: false matrix: include: - os: ubuntu-latest python-version: "3.10" dependency-set: minimum - os: macos-15-intel # We need x86 as ARM is python>= 3.11 only. # https://github.com/actions/setup-python/issues/855 python-version: "3.10" dependency-set: minimum - os: ubuntu-latest python-version: "3.13" dependency-set: maximum - os: macos-latest python-version: "3.13" dependency-set: maximum runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: cache: 'pip' python-version: ${{ matrix.python-version }} architecture: x64 - name: Install workflow Python deps run: python -m pip install pip-tools tomli - name: Generate requirements file for minimum dependencies if: matrix.dependency-set == 'minimum' run: python scripts/gen_requirements.py min requirements-generated.txt - name: Generate requirements file for maximum dependencies if: matrix.dependency-set == 'maximum' run: python scripts/gen_requirements.py max requirements-generated.txt - name: Generate requirements file for dev dependencies run: python scripts/gen_requirements.py --dev passthrough dev-requirements-generated.txt # Caching based on dependency set and python version. It needs to be done post any operations that modifies the file (like `write`, `touch`, etc.) that can change the hash of the dependency file and lead to a cache miss. # REFER: https://github.com/actions/setup-python#caching-packages-dependencies - name: Setup pip cache id: pip-cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.dependency-set }}-${{ hashFiles('pyproject.toml', 'requirements-generated.txt', 'dev-requirements-generated.txt')}} restore-keys: | ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.dependency-set }}- ${{ runner.os }}-pip-${{ matrix.python-version }}- - name: Install dependencies id: install-deps run: | echo "::group::Installing dependencies" START_TIME=$(date +%s%N) python -m pip install --upgrade pip pip install -e . --no-deps pip install -r requirements-generated.txt pip install -r dev-requirements-generated.txt END_TIME=$(date +%s%N) DURATION=$((($END_TIME - $START_TIME)/1000000)) echo "duration=$DURATION" >> $GITHUB_OUTPUT echo "Dependencies installation took $DURATION ms" echo "::endgroup::" - name: Initialize submodules run: git submodule update --init --recursive - name: Check for forbidden licenses if: runner.os == 'macOS' && matrix.python-version == '3.10' run: | licensecheck \ --requirements-paths pyproject.toml \ --only-licenses APACHE MIT BSD ISC PYTHON ZLIB UNLICENSE UNKNOWN \ --ignore-packages certifi "tabpfn*" \ --show-only-failing \ -0 - name: Report cache status run: | echo "Cache status: ${{ steps.pip-cache.outputs.cache-hit == 'true' && 'HIT' || 'MISS'}}" echo "Installation time: ${{ steps.install-deps.outputs.duration }} ms" - name: Run Tests run: | pytest
What changed
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.