$ show astral-sh/ruff-pre-commit
This repository serves as a pre-commit hook configuration for Ruff, an extremely fast Python linter and formatter. It defines three pre-commit hooks: `ruff-check`, `ruff-format`, and a legacy `ruff` alias. The core operational code is a single Python script (`mirror.py`) that automates version mirroring: it fetches the latest Ruff release from PyPI and updates version strings in `pyproject.toml` and `README.md`. A GitHub Actions workflow runs this script on a schedule (every 4 hours), commits changes, tags releases, and creates GitHub releases. The repository is a minimal, well-structured wrapper that enables installing Ruff via pre-commit hooks. There is no application logic beyond the mirror script; the project's value is in its configuration and automation pipeline for staying in sync with upstream Ruff releases.
The LLM identified 1 files worth highlighting for reuse:
A self-contained script that automates updating the pinned Ruff version across the repository. It uses PEP 723 inline script metadata for dependency declaration, `urllib3` to query PyPI for available versions, `packaging` for version comparison, and regex-based file rewriting to update `pyproject.toml` and `README.md`. This pattern is reusable for any project that needs to mirror upstream version bumps, as it cleanly separates version fetching, comparison, and file patching logic. The script is executed in CI to keep the pre-commit hook definitions automatically aligned with the latest Ruff release.