Python application workflow (jesse-ai/jesse)
The Python application workflow from jesse-ai/jesse, explained and optimized by Latchkey.
CI health: A - excellent
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 Python application workflow from the jesse-ai/jesse repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
# ubuntu-latest = Linux x86_64
# ubuntu-24.04-arm = Linux aarch64 (free for public repos)
# macos-latest = Apple Silicon (arm64) on GitHub-hosted runners
# windows-latest = Windows x86_64 (no ARM target; Windows-on-ARM excluded)
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
exclude:
# ray has no Windows wheel for Python 3.13 yet (as of ray 2.55.1).
# Drop this exclude once upstream ships ray-*-cp313-cp313-win_amd64.whl.
- os: windows-latest
python-version: '3.13'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
shell: bash
run: |
python -m ensurepip --upgrade
python -m pip install --upgrade pip
python -m pip install setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e . -U
- name: Test with pytest
shell: bash
env:
PYTEST_DISABLE_PLUGIN_AUTOLOAD: 1
run: |
python -m pytest
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Python application on: push: branches: [ master ] pull_request: branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: build: timeout-minutes: 30 runs-on: ${{matrix.os}} strategy: matrix: # ubuntu-latest = Linux x86_64 # ubuntu-24.04-arm = Linux aarch64 (free for public repos) # macos-latest = Apple Silicon (arm64) on GitHub-hosted runners # windows-latest = Windows x86_64 (no ARM target; Windows-on-ARM excluded) os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] python-version: ['3.10', '3.11', '3.12', '3.13'] exclude: # ray has no Windows wheel for Python 3.13 yet (as of ray 2.55.1). # Drop this exclude once upstream ships ray-*-cp313-cp313-win_amd64.whl. - os: windows-latest python-version: '3.13' steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: pip - name: Install dependencies shell: bash run: | python -m ensurepip --upgrade python -m pip install --upgrade pip python -m pip install setuptools wheel if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e . -U - name: Test with pytest shell: bash env: PYTEST_DISABLE_PLUGIN_AUTOLOAD: 1 run: | python -m pytest
What changed
- 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 (16 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.