Skip to content
Latchkey

polars-checks workflow (business-science/pytimetk)

The polars-checks workflow from business-science/pytimetk, explained and optimized by Latchkey.

D

CI health: D - needs work

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: business-science/pytimetk.github/workflows/polars-checks.yamlLicense MITView source

What it does

This is the polars-checks workflow from the business-science/pytimetk 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

workflow (.yml)
name: polars-checks

on:
  schedule:
    - cron: '0 0 1 * *'
  push:
    branches:
      - main
      - master
  pull_request:
    branches:
      - main
      - master

jobs:
  build:

    strategy:
      fail-fast: false
      matrix:
        config:
          # - { os: ubuntu-latest, python-version: '3.9', polars-version: '0.19.10' }
          - { os: ubuntu-latest, python-version: '3.9', polars-version: '1.2.0' }
          # Latest polars requires Python >= 3.10.
          - { os: ubuntu-latest, python-version: '3.10', polars-version: 'latest' }

    defaults:
      run:
        shell: bash

    runs-on: ${{ matrix.config.os }}

    name: ${{ matrix.config.os }} (${{ matrix.config.python-version }}) - polars ${{ matrix.config.polars-version }}

    steps:
      - name: Set up Python Version
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.config.python-version }}

      - name: Check-out repository
        uses: actions/checkout@v4

      - name: Install poetry
        run: |
          python -m pip install --upgrade pip
          python -m pip install poetry==2.0.1

      - name: Install package
        run: |
          poetry install
          if [ "${{ matrix.config.polars-version }}" == "latest" ]; then
            poetry run python -m pip install --upgrade "polars"
          else
            poetry run python -m pip install --upgrade "polars==${{ matrix.config.polars-version }}"
          fi
      
      - run: poetry run pytest --version

      - name: Test with pytest
        run: poetry run pytest tests/ --verbose

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: polars-checks
 
on:
  schedule:
    - cron: '0 0 1 * *'
  push:
    branches:
      - main
      - master
  pull_request:
    branches:
      - main
      - master
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
 
    strategy:
      fail-fast: false
      matrix:
        config:
          # - { os: ubuntu-latest, python-version: '3.9', polars-version: '0.19.10' }
          - { os: ubuntu-latest, python-version: '3.9', polars-version: '1.2.0' }
          # Latest polars requires Python >= 3.10.
          - { os: ubuntu-latest, python-version: '3.10', polars-version: 'latest' }
 
    defaults:
      run:
        shell: bash
 
    runs-on: ${{ matrix.config.os }}
 
    name: ${{ matrix.config.os }} (${{ matrix.config.python-version }}) - polars ${{ matrix.config.polars-version }}
 
    steps:
      - name: Set up Python Version
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.config.python-version }}
 
      - name: Check-out repository
        uses: actions/checkout@v4
 
      - name: Install poetry
        run: |
          python -m pip install --upgrade pip
          python -m pip install poetry==2.0.1
 
      - name: Install package
        run: |
          poetry install
          if [ "${{ matrix.config.polars-version }}" == "latest" ]; then
            poetry run python -m pip install --upgrade "polars"
          else
            poetry run python -m pip install --upgrade "polars==${{ matrix.config.polars-version }}"
          fi
      
      - run: poetry run pytest --version
 
      - name: Test with pytest
        run: poetry run pytest tests/ --verbose
 

What changed

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:

This workflow runs 1 job (2 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow