explainerdashboard workflow (oegedijk/explainerdashboard)
The explainerdashboard workflow from oegedijk/explainerdashboard, explained and optimized by Latchkey.
CI health: F - at risk
Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the explainerdashboard workflow from the oegedijk/explainerdashboard 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 variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: explainerdashboard
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
uv-version: 'latest'
- name: Cache uv global directory
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
- name: Install dependencies
run: |
# Install the current project (.) and its 'test' and 'docs' extras.
# Quotation marks around ".[test,docs]" are good practice for shells.
uv pip install ".[test,docs]" --system
- name: Verify script installation (for debugging)
run: |
echo "Python version: $(python --version)"
echo "uv version: $(uv --version)"
echo "PYTHONUSERBASE: $PYTHONUSERBASE"
echo "PIP_USER: $PIP_USER"
echo "Checking for explainerdashboard script..."
if [[ "$RUNNER_OS" == "Windows" ]]; then
Get-Command explainerdashboard -ErrorAction SilentlyContinue || echo "explainerdashboard not found"
Get-Command explainerhub -ErrorAction SilentlyContinue || echo "explainerhub not found"
echo "PATH: $($env:PATH)"
else
which explainerdashboard || echo "explainerdashboard not found in PATH"
which explainerhub || echo "explainerhub not found in PATH"
echo "PATH: $PATH"
fi
# Show where packages are installed and scripts path
PYTHON_SCRIPTS_PATH=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))")
echo "Python scripts directory (from sysconfig): $PYTHON_SCRIPTS_PATH"
if [[ -d "$PYTHON_SCRIPTS_PATH" ]]; then
ls -alh "$PYTHON_SCRIPTS_PATH"
else
echo "Scripts directory does not exist or is not accessible."
fi
- name: Lint with ruff
run: |
uv run ruff check --ignore=F405,F403,E402
- name: Test with pytest
run: |
pytest -k "not selenium"
scheduled_full_suite:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
uv-version: 'latest'
- name: Cache uv global directory
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-uv-3.11-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-3.11-
- name: Install dependencies
run: |
uv pip install ".[test,docs]" --system
- name: Run full test suite
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.
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: explainerdashboard on: push: branches: [ master ] pull_request: branches: [ master ] schedule: - cron: '0 0 * * 0' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 if: github.event_name != 'schedule' runs-on: latchkey-small strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: cache: 'pip' python-version: ${{ matrix.python-version }} - name: Install uv uses: astral-sh/setup-uv@v1 with: uv-version: 'latest' - name: Cache uv global directory uses: actions/cache@v4 with: path: ${{ env.UV_CACHE_DIR }} key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} restore-keys: | ${{ runner.os }}-uv-${{ matrix.python-version }}- - name: Install dependencies run: | # Install the current project (.) and its 'test' and 'docs' extras. # Quotation marks around ".[test,docs]" are good practice for shells. uv pip install ".[test,docs]" --system - name: Verify script installation (for debugging) run: | echo "Python version: $(python --version)" echo "uv version: $(uv --version)" echo "PYTHONUSERBASE: $PYTHONUSERBASE" echo "PIP_USER: $PIP_USER" echo "Checking for explainerdashboard script..." if [[ "$RUNNER_OS" == "Windows" ]]; then Get-Command explainerdashboard -ErrorAction SilentlyContinue || echo "explainerdashboard not found" Get-Command explainerhub -ErrorAction SilentlyContinue || echo "explainerhub not found" echo "PATH: $($env:PATH)" else which explainerdashboard || echo "explainerdashboard not found in PATH" which explainerhub || echo "explainerhub not found in PATH" echo "PATH: $PATH" fi # Show where packages are installed and scripts path PYTHON_SCRIPTS_PATH=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))") echo "Python scripts directory (from sysconfig): $PYTHON_SCRIPTS_PATH" if [[ -d "$PYTHON_SCRIPTS_PATH" ]]; then ls -alh "$PYTHON_SCRIPTS_PATH" else echo "Scripts directory does not exist or is not accessible." fi - name: Lint with ruff run: | uv run ruff check --ignore=F405,F403,E402 - name: Test with pytest run: | pytest -k "not selenium" scheduled_full_suite: timeout-minutes: 30 if: github.event_name == 'schedule' runs-on: latchkey-small steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 uses: actions/setup-python@v4 with: cache: 'pip' python-version: '3.11' - name: Install uv uses: astral-sh/setup-uv@v1 with: uv-version: 'latest' - name: Cache uv global directory uses: actions/cache@v4 with: path: ${{ env.UV_CACHE_DIR }} key: ${{ runner.os }}-uv-3.11-${{ hashFiles('**/pyproject.toml') }} restore-keys: | ${{ runner.os }}-uv-3.11- - name: Install dependencies run: | uv pip install ".[test,docs]" --system - name: Run full test suite run: | pytest
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- 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.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
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
- End-to-end and browser tests
This workflow runs 2 jobs (13 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.