Skip to content

feat: replace mirror.py + versions.py with repo-release-tools v1.10.1 rrt sync #174

Description

@Anselmoo

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:

[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:

# before
- name: Mirror new ruff versions
  run: |
    uv run --no-project mirror.py
# 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

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