Skip to content

Prepare release: bump the sample's model file and lock, and the README's alpha line, with pyproject.toml - #224

Merged
jasperblues merged 2 commits into
mainfrom
release-version-refs
Oct 28, 2026
Merged

jasperblues merged 2 commits into
mainfrom
release-version-refs

Conversation

@jasperblues

Copy link
Copy Markdown
Member

"Prepare release" used to bump only pyproject.toml and uv.lock, so a release left these files naming the old version:

  • sample/.drivine/model.json, which records the generator version. python -m drivine.stubs --check, in sample/tests/test_typed_refs_up_to_date.py, compares the whole file. To prove it, I bumped only the build file: the check failed with "Out of date: …/sample/.drivine/model.json".
  • sample/poetry.lock: the drivine package entry, in PEP 440 form. Release 0.3.0 #196 missed this one. Running poetry lock after a bump changes exactly that line.
  • README.md's "0.2 is an alpha release" line.

What changes

  • scripts/release_version.py references VERSION rewrites an explicit REFERENCES list, each entry matched by an anchored pattern. The model file gets the version as written (0.3.0-rc.1). The lock gets it in PEP 440 form (0.3.0rc1), through a stdlib pep440() that a test compares with packaging on 16 versions. The README line has only its MAJOR.MINOR rewritten.
    • Each reference must match exactly once. Every file is checked before any is written, so a reworded line fails loudly and nothing changes.
  • prepare-release.yml runs it after uv lock and git adds the files it prints. A new guard fails the run if anything is left unstaged.
  • Tests:
    • every reference rewritten, including a prerelease;
    • decoys left alone (drivine-extra, pi-pilgrim at the same version, another library's model file);
    • a missing, doubled or reworded reference fails without writing anything;
    • every .drivine/model.json in the repo is on the list;
    • a repository-consistency test, which runs in CI, checks that every reference names pyproject.toml's version.
  • RELEASING.md lists the files and why each one moves.

Verified

  • An end-to-end bump to 0.3.0 in a scratch clone, run as the workflow runs it, changes exactly README.md, pyproject.toml, sample/.drivine/model.json, sample/poetry.lock and uv.lock.
  • After the bump, the sample's stubs check passes, poetry check --lock passes, and poetry lock changes nothing. So each rewrite matches what the generator and Poetry write. The same holds for 0.3.0-rc.1.
  • ruff, pyright and the unit tests pass.
  • Reviewed in four passes. The last, an independent one with a pep440() fuzz against packaging, was clean.

Follow-ups, not in this PR

  • The sample's check isn't run in CI: ci.yml's pytest covers only tests/. The new consistency test does catch a version mismatch in CI. Running the sample's stubs check in CI too, which needs no database, would catch other drift.
  • Move the README's docs into docs/, and keep a short README #223 copies the alpha line into docs/00-introduction.md. When it's rebased, it should add that file to REFERENCES.

This replaces the hand-made release PR #196: Prepare release now makes all of #196's changes, plus sample/poetry.lock.

…ample's model file and poetry.lock, and the README

Prepare release raised pyproject.toml and uv.lock alone, so its PR left the sample's model file naming the old
generator version, which the sample's test of its typed references fails on, the sample's poetry.lock recording
the old drivine, and the README's "0.2 is an alpha release" behind. scripts/release_version.py references
rewrites each, from a list kept in the script, with patterns tight enough not to hit another package's version, and
fails when one isn't found exactly once. The workflow commits what it lists, and fails if the bump changed anything
it doesn't commit.
@jasperblues
jasperblues merged commit 2977bb1 into main Oct 28, 2026
16 checks passed
@jasperblues jasperblues mentioned this pull request Oct 28, 2026
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