# Code Checks workflow (pandas-dev/pandas)

> The Code Checks workflow from pandas-dev/pandas, explained and optimized by Latchkey.

Source: https://latchkey.dev/workflows/pandas-dev-pandas-code-checks  
Upstream: [pandas-dev/pandas](https://github.com/pandas-dev/pandas/blob/main/.github/workflows/code-checks.yml) (.github/workflows/code-checks.yml), licence BSD-3-Clause

## What it does

This is the Code Checks workflow from the pandas-dev/pandas repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

## The workflow

```yaml
name: Code Checks

on:
  push:
    branches:
      - main
      - 3.0.x
  pull_request:
    branches:
      - main
      - 3.0.x

defaults:
  run:
    shell: bash -euox pipefail {0}

permissions: {}

jobs:
  doctest:
    name: Doctests
    runs-on: ubuntu-24.04
    permissions:
      contents: read

    concurrency:
      # https://github.community/t/concurrecy-not-work-for-push/183068/7
      group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-doctests
      cancel-in-progress: true

    steps:
    - name: Checkout
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        fetch-depth: 0

    - name: Create virtual environment with Pixi
      uses: ./.github/actions/setup-pixi
      with:
        environment: "doctests"

    - name: Build pandas
      run: |
        pixi run \
          --environment doctests \
          build-pandas \
          --editable \
          -Csetup-args="--werror"

    - name: Run doctests
      run: pixi run --environment doctests ci-doctests

    - name: Run scripts tests
      run: pixi run --environment doctests ci-scripts-tests

  type-checking:
    name: Type Checking
    runs-on: ubuntu-24.04
    permissions:
      contents: read

    concurrency:
      # https://github.community/t/concurrecy-not-work-for-push/183068/7
      group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-typechecking
      cancel-in-progress: true

    steps:
    - name: Checkout
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        fetch-depth: 0

    - name: Create virtual environment with Pixi
      uses: ./.github/actions/setup-pixi
      with:
        environment: "typing"

    - name: Build pandas
      run: |
        pixi run \
          --environment typing \
          build-pandas \
          --editable \
          -Csetup-args="--werror"

    - name: Typing Checks
      run: pixi run --environment typing ci-typing

  asv-benchmarks:
    name: ASV Benchmarks
    runs-on: ubuntu-24.04
    permissions:
      contents: read

    concurrency:
      # https://github.community/t/concurrecy-not-work-for-push/183068/7
      group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-asv-benchmarks
      cancel-in-progress: true

    steps:
    - name: Checkout
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        fetch-depth: 0

    - name: Create virtual environment with Pixi
      uses: ./.github/actions/setup-pixi
      with:
        environment: "asv"

    - name: Build pandas
      run: |
        pixi run \
          --environment asv \
          build-pandas \
          --editable \
          -Csetup-args="--werror"

    - name: Run ASV benchmarks
      run: pixi run --environment asv ci-asv

  requirements-dev-text-installable:
    name: Test install requirements-dev.txt
    runs-on: ubuntu-24.04
    permissions:
      contents: read

    concurrency:
      # https://github.community/t/concurrecy-not-work-for-push/183068/7
      group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-requirements-dev-text-installable
      cancel-in-progress: true

    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - name: Setup Python
        id: setup_python
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
        with:
          python-version: '3.11'
          cache: 'pip'
          pip-install: '-r requirements-dev.txt'
          cache-dependency-path: 'requirements-dev.txt'

      - name: Check Pip Cache Hit
        run: echo ${{ steps.setup_python.outputs.cache-hit }}
```

## FAQ

### What does the Code Checks workflow (pandas-dev/pandas) workflow do?

This is the Code Checks workflow from the pandas-dev/pandas repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

### What CI health grade does this workflow get?

This Python workflow grades C. Paste your own workflow into the Latchkey grader to see its grade and the exact fixes.

### How can I improve this Python workflow?

Add run de-duplication and job timeouts. Latchkey applies these automatically on managed runners when you point runs-on at Latchkey.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
