Skip to content

Switch from pre-commit to prek#182

Merged
chrisguidry merged 3 commits intomainfrom
switch-to-prek
Nov 4, 2025
Merged

Switch from pre-commit to prek#182
chrisguidry merged 3 commits intomainfrom
switch-to-prek

Conversation

@zzstoatzz
Copy link
Copy Markdown
Collaborator

Summary

Replace pre-commit with prek, a Rust-based reimplementation that offers superior performance and efficiency while maintaining full compatibility with existing .pre-commit-config.yaml files.

Key Benefits

  • faster: multiple times faster than pre-commit
  • smaller: uses half the disk space
  • drop-in: fully compatible with existing config

Changes Made

  • Replaced pre-commit>=4.1.0 with prek>=0.2.13 in pyproject.toml
  • Updated CI workflow (.github/workflows/ci.yml):
    • Renamed job from pre-commit to prek
    • Switched to prek-rs/prek-action@v2 for caching and execution
    • Removed unnecessary uv pip install pip step
  • Updated documentation in CLAUDE.md:
    • Changed pre-commit run --all-files to uv run prek run --all-files
    • Changed pre-commit install to uv run prek install

Test Plan

  • Installed prek hooks locally with uv run prek install
  • Verified all hooks pass with uv run prek run --all-files
  • CI workflow validates on PR

🤖 Generated with Claude Code

Replace pre-commit with prek, a Rust-based reimplementation offering:
- Multiple times faster than pre-commit
- Half the disk space usage
- Drop-in compatibility with existing .pre-commit-config.yaml

Changes:
- Replace pre-commit with prek>=0.2.13 in pyproject.toml
- Update CI workflow to use prek-rs/prek-action@v2
- Update CLAUDE.md documentation to use prek commands
- Remove unnecessary pip installation from CI workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Nov 4, 2025

Claude finished @zzstoatzz's task —— View job


Pull Request Review: Switch from pre-commit to prek

✅ Summary

This PR successfully migrates from pre-commit to prek, a Rust-based reimplementation. The changes are clean, minimal, and well-executed. Test coverage remains at 100%, and CI is passing.

📋 Review Feedback

✅ Strengths

  1. Clean Migration: The change is minimal and focused - only updating what's necessary
  2. CI Improvements: The workflow change correctly uses j178/prek-action@v1 with proper caching
  3. Documentation Consistency: All references to pre-commit have been properly updated
  4. Compatibility: The existing .pre-commit-config.yaml remains unchanged, confirming prek's drop-in compatibility claim

🔍 Observations & Suggestions

  1. CI Workflow Fix ✅: Good catch on updating the action to j178/prek-action@v1 (from the originally incorrect prek-rs/prek-action@v2)

  2. Dependency Management:

    • The change from pre-commit>=4.1.0 to prek>=0.2.13 in pyproject.toml:56 is appropriate
    • The uv.lock changes reflect proper dependency resolution
  3. Documentation:

    • CLAUDE.md updates correctly show uv run prek commands (lines 38, 48)
    • The documentation maintains consistency with the actual usage pattern
  4. Minor Enhancement Opportunity:

    • Consider adding a note in the README or contributing guide about the switch to prek, especially if other contributors are accustomed to pre-commit. This could help with onboarding.

✅ Security & Performance

  • No security concerns identified
  • Performance improvements are expected based on prek's Rust implementation
  • Disk space savings should be realized as claimed

✅ Test Coverage

  • Coverage remains at 100% across all Python versions ✅
  • CI is green and all checks are passing

🎯 Verdict

LGTM! This is a well-executed migration that maintains all existing functionality while providing performance benefits. The changes are minimal, focused, and preserve the project's high standards.

Review Checklist

  • Analyze CI workflow changes
  • Review documentation updates
  • Verify dependency change
  • Check for compatibility and best practices
  • Provide comprehensive feedback

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (afb074d) to head (250ef74).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #182   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        34           
  Lines         5216      5216           
  Branches       265       265           
=========================================
  Hits          5216      5216           
Flag Coverage Δ
python-3.10 100.00% <ø> (ø)
python-3.11 98.79% <ø> (ø)
python-3.12 100.00% <ø> (ø)
python-3.13 100.00% <ø> (ø)
python-3.14 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 4, 2025

📚 Documentation has been built for this PR!

You can download the documentation directly here:
https://github.com/chrisguidry/docket/actions/runs/19072898082/artifacts/4462894362

@zzstoatzz zzstoatzz marked this pull request as ready for review November 4, 2025 15:00
@chrisguidry chrisguidry merged commit eb8269f into main Nov 4, 2025
25 checks passed
@chrisguidry chrisguidry deleted the switch-to-prek branch November 4, 2025 15:03
chrisguidry added a commit that referenced this pull request Mar 10, 2026
croniter 6.0.0 has two unbounded memory leaks
([#182](pallets-eco/croniter#182),
[#195](pallets-eco/croniter#195)) that are
fixed in main but unreleased — and the project was declared unmaintained
by Pallets Community Ecosystem in March 2025, so no release is coming.
It also drags in pytz and python-dateutil as transitive deps.

cronsim is actively maintained (~280 lines, zero deps, Python 3.10+),
used in production by Healthchecks.io, and handles DST via zoneinfo
natively. One gap: cronsim doesn't support Vixie keywords (@daily,
@hourly, etc.), so we add a small mapping dict that expands them before
passing to CronSim.

Also extracted `Cron.next_time()` so tests mock at docket's abstraction
level rather than the library's internals, and added contract tests that
exercise the real cronsim integration (sequential times, timezone
handling, keyword validity).

Companion conda-forge PR: conda-forge/pydocket-feedstock#34

Closes #362

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chrisguidry added a commit that referenced this pull request Mar 10, 2026
croniter 6.0.0 has two unbounded memory leaks
([#182](pallets-eco/croniter#182),
[#195](pallets-eco/croniter#195)) that are
fixed in main but unreleased — and the project was declared unmaintained
by Pallets Community Ecosystem in March 2025, so no release is coming.
It also drags in pytz and python-dateutil as transitive deps.

cronsim is actively maintained (~280 lines, zero deps, Python 3.10+),
used in production by Healthchecks.io, and handles DST via zoneinfo
natively. One gap: cronsim doesn't support Vixie keywords (@daily,
@hourly, etc.), so we add a small mapping dict that expands them before
passing to CronSim.

Also extracted `Cron.next_time()` so tests mock at docket's abstraction
level rather than the library's internals, and added contract tests that
exercise the real cronsim integration (sequential times, timezone
handling, keyword validity).

Companion conda-forge PR:
conda-forge/pydocket-feedstock#34

Closes #362

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants