Skip to content

Automate Pyrefly version pins with a generator + CI drift check#3

Merged
tague merged 1 commit into
mainfrom
tague/pyrefly-known-versions-script
Jul 17, 2026
Merged

Automate Pyrefly version pins with a generator + CI drift check#3
tague merged 1 commit into
mainfrom
tague/pyrefly-known-versions-script

Conversation

@tague

@tague tague commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Part 3 of 3 for the 0.3.0 release.

The four default_known_versions pins in subsystems.py (<version>|<platform>|<sha256>|<size>) were hand-computed on every Pyrefly bump. This adds build-support/bin/generate_known_versions.py (stdlib only) that:

  • reads the version, URL template, and platform mapping straight out of subsystems.py via ast, so the script and the plugin can never disagree;
  • fetches each asset's published .sha256 sidecar and size from the facebook/pyrefly GitHub release (falling back to downloading + hashing the asset).

Modes: print the pins, --version to target a release, --write to splice the new version + pins back into subsystems.py (preserving formatting), and --check to fail if the committed pins drift. CI runs --check.

Adds /build-support/bin as a source root (keeps it linted/checked/tested; outside the pants_pyrefly package, so it never enters the wheel), plus a pure-logic unit test (no network).

Verification

  • pants fmt lint check test build-support/bin:: ✓ — ruff, Pyrefly-on-the-script (0 errors), unit tests
  • pants lint check :: ✓ repo-wide
  • Live --check against the real GitHub release ✓ ("pins are current for 1.1.1")
  • --write roundtrip reproduces subsystems.py byte-identically

The four `default_known_versions` pins in subsystems.py
(`<version>|<platform>|<sha256>|<size>`) were hand-computed on every Pyrefly
bump. Add `build-support/bin/generate_known_versions.py` (stdlib only) that reads
the version, URL template, and platform mapping straight out of subsystems.py via
`ast` — so the script and the plugin can never disagree — then fetches each
asset's published `.sha256` sidecar and size from the facebook/pyrefly GitHub
release (falling back to downloading + hashing the asset).

Modes: print the pins, `--version` to target a release, `--write` to splice the
new version + pins back into subsystems.py (preserving formatting), and `--check`
to fail if the committed pins drift from the release. CI runs `--check`.

Adds `/build-support/bin` as a source root (keeps it linted/checked/tested;
outside the `pants_pyrefly` package, so it never enters the wheel), a pure-logic
unit test (no network), a README maintenance section, and a 0.3.0 changelog entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tague
tague merged commit eaaa2e3 into main Jul 17, 2026
4 checks passed
@tague
tague deleted the tague/pyrefly-known-versions-script branch July 17, 2026 17:28
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.

1 participant