astral-sh / astral-sh/ruff-pre-commit
feat: replace mirror.py + versions.py with repo-release-tools v1.10.1 rrt sync
- Dominant language
- Python
- Stars
- 2k
- Forks
- 105
- Avg merge
- 8h 36m
- Merged PRs (30d)
- 1
Description
## Context
Issue #171 identified that `mirror.py` missed the TOML-style `rev = "v..."` pattern in `README.md` due to hardcoded regexes.
PR #172 proposed replacing `mirror.py` with `repo-release-tools v1.10.0`, using:
- `versions.py` — a thin PEP 723 script for PyPI polling
- `rrt bump … --no-commit` in a CI shell loop for file updates + commits
## This proposal
**repo-release-tools v1.10.1** (released 2026-06-26) ships `rrt sync`, which makes `versions.py` and the shell loop entirely obsolete.
`rrt sync --bump --commit --tag` does everything in one call:
| Responsibility | Before (mirror.py) | After (rrt sync) |
|---|---|---|
| PyPI polling | `mirror.py` — hardcoded urllib3 script | built-in, stdlib HTTP, zero extra deps |
| File update patterns | hardcoded regexes in Python | config-driven `version_targets` + `pin_targets` |
| Version iteration | hardcoded loop in Python | built-in, ascending |
| Git commit | hardcoded `git commit` in script | `--commit` (template: `Mirror: {version}`) |
| Git tag | hardcoded `git tag` in script | `--tag` (annotated, prefix `v`) |
| CI step | `uv run --no-project mirror.py` | `rrt sync --bump --commit --tag` |
## Proposed changes
### `pyproject.toml`
Add an `[tool.rrt.upstream]` sub-table and bump the dev dependency:
```toml
[dependency-groups]
dev = [
"repo-release-tools>=1.10.1",
]
[tool.rrt]
release_branch = "main"
lock_command = []
[tool.rrt.upstream]
package = "ruff"
provider = "pypi"
commit_message = "Mirror: {version}"
[[tool.rrt.version_targets]]
path = "pyproject.toml"
kind = "pattern"
pattern = 'ruff==(\d+\.\d+\.\d+)'
[[tool.rrt.pin_targets]]
path = "README.md"
pattern = '(rev: v)(\d+\.\d+\.\d+)()'
[[tool.rrt.pin_targets]]
path = "README.md"
pattern = '(rev = "v)(\d+\.\d+\.\d+)(")'
[[tool.rrt.pin_targets]]
path = "README.md"
pattern = '(/ruff/)(\d+\.\d+\.\d+)(\.svg)'
```
### `.github/workflows/main.yml`
Replace the 11-line shell loop with a single call:
```yaml
# before
- name: Mirror new ruff versions
run: |
uv run --no-project mirror.py
```
```yaml
# after
- name: Mirror new ruff versions
run: uvx "repo-release-tools==$RRT_VERSION" sync --bump --commit --tag
env:
RRT_VERSION: "1.10.1"
```
### Delete `mirror.py` and `versions.py`
No longer needed — `rrt sync` handles PyPI polling, file updates, commits, and tagging internally.
## Dry-run output
```
✓ [DRY RUN] Mirror upstream ruff (pypi)
→ Current: 0.15.18
── Plan ──────────────────────────────────────────────────────
⊙ [dry-run] Would bump → 0.15.19 (files: pyproject.toml, README.md)
⊙ [dry-run] Would commit: "Mirror: 0.15.19"
⊙ [dry-run] Would tag: v0.15.19
⊙ [dry-run] Would bump → 0.15.20 (files: pyproject.toml, README.md)
⊙ [dry-run] Would commit: "Mirror: 0.15.20"
⊙ [dry-run] Would tag: v0.15.20
⊙ [dry-run] complete – no changes made
```
All four patterns (pyproject.toml dep, YAML rev, TOML rev, badge URL) are updated correctly — including the TOML `rev = "v..."` pattern that caused #171.
Ref: #171, #172
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing pyproject.toml, .github/workflows/main.yml, mirror.py, and versions.py, then run the proposed repo-release-tools 1.10.1 sync in dry-run mode. Done means the configuration covers all listed version targets, the workflow uses the single sync command, the obsolete scripts are deleted, and commits and tags are produced as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, python
- Domain
- ci-cd, release, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100