Skip to content

Swap pre-commit for prek #853

@drbenvincent

Description

@drbenvincent

Motivation

prek is a faster, compatible replacement for pre-commit. The speed improvement is especially relevant when AI agents run checks after every round of edits, but it also benefits normal developer workflows.

This was already done for CausalPy in pymc-labs/CausalPy#780.

Proposed changes

Local developer workflow

  • Replace pre-commit install with prek install in setup/contributor docs.
  • Contributors install prek instead of pre-commit (the .pre-commit-config.yaml format is compatible, no hook config changes needed).

CI

  • Replace the current pre-commit/action@v3.0.0 GitHub Action (.github/workflows/pre-commit.yml) with j178/prek-action.
  • Use smart scoping: --from-ref / --to-ref on pull requests to only check changed files, and --all-files on pushes to main.

Documentation

  • Update CONTRIBUTING.md references from pre-commit to prek.
  • Update any other docs or contributor guides that mention pre-commit.

Current setup

The repo currently uses:

  • .pre-commit-config.yaml with hooks for black, nbqa (isort, pyupgrade), execution-order checking, bibtex-tidy, watermark checks, notebook-name checks, reference-url checks, and jupytext sync.
  • .github/workflows/pre-commit.yml running pre-commit/action@v3.0.0 on PRs and pushes to main.
  • CONTRIBUTING.md referencing pre-commit in the PR checklist.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions