Cut a release#
A release is a Git tag. The tag starts three jobs: the publication to PyPI, the GitHub Release, and the build of the documentation for that version. This page is the maintainer’s checklist. What each kind of version may change is in Versions and stability, the only statement of that contract.
Version and tag syntax#
Versions follow Semantic Versioning for meaning and PEP 440 for the string.
MAJOR.MINOR.PATCH 2.0.0
MAJOR.MINOR.PATCHaN 2.0.0a1 alpha
MAJOR.MINOR.PATCHbN 2.0.0b1 beta
MAJOR.MINOR.PATCHrcN 2.0.0rc1 release candidate
The Git tag is the version with a leading v: v2.0.0rc1, v2.0.0. Do not
invent other forms such as release-v2 or v2-beta.
Five places must agree#
Where |
What |
|---|---|
|
|
|
|
|
|
|
A section |
|
The table of supported versions, when the release opens a new line or ends the support of an old one. |
The Git tag |
|
publish.yml refuses a tag that does not match pyproject.toml.
The checklist#
Choose the version from the change, with Versions and stability.
Choose the branch. Normal work comes from
dev. A stabilization window usesrelease/X.Y. A fix on an old line starts from the tag it fixes (hotfix/X.Y.Z).v1.0is frozen atv1.0.0: do not release from it.Set the version in
pyproject.tomland_FALLBACK_VERSION.Write the changelog. Move the content of
[Unreleased]to the new section and leave[Unreleased]empty for the next release. Put no---rule right under the empty heading: the docs include the file, and the strict build refuses a section that begins with a rule. Use the Keep a Changelog categories: Added, Changed, Deprecated (only for an announced removal), Removed, Fixed, Security, plusNumbersfor anything that changes a number of a run. The reason for a change belongs here. The release job takes the section as the body of the GitHub Release. It looks for the section of the tag and ends it at the next## [heading, so the section must exist and must not be the last one of the file.Read the numbers section. Each entry names the quantity and the size of the change, and has its row in
hydromodpy/schema/changes.toml, under the rule of Changing a number. The bullets come from that file: runpython -m tools.changes_changelogand it prints the difference when the block between<!-- numbers:begin -->and<!-- numbers:end -->is out of date.python -m tools.changes_changelog --writewrites it. A pin moved since the last tag has its row too, under the rule of Moving a pinned binary.Review the surface snapshots. Read what changed since the last tag:
git diff vX.Y.Z -- tests/unit/architecture/surface/. Each removed or renamed line must be in the changelog with both names, and each TOML key it removes must be inremoved_toml_keys.tsv, with its[[migration]]row inhydromodpy/schema/changes.toml. The row stays in the register after its delay, because a live file is then refused with the new name and a sealed run still reads it, so it is never removed. What does go is a name of_lazy.pyorconventions.pypast its delay, whichtests/unit/architecturenames, and the listhydromodpy/config/prerelease_forms.txt, which goes in 2.2.0.Regenerate the example catalog.
hmp example addfetches the files at the tag of the installed version and checks them againstcatalog.toml. Runpython -m tools.dev examples manifestand commit the result, or every download of the release fails on a checksum. Then runpython tools/ci/check_example_catalog.pyfrom the commit to tag. It hashes each file the catalog names, as CI and the release gate do.Check. Run
ruff checkandruff format --check, the architecture gate and the tests of what changed, and build the docs (make -C docs html-strict). CI repeats them.Commit the preparation in one line, for example
chore(release): prepare v2.0.0b1.Tag the commit with an annotated tag, then send the tag to the remote.
git tag -a v2.0.0b1 -m "v2.0.0b1" git push origin v2.0.0b1
A tag is immutable. A botched release is fixed by a new tag, never by moving the old one.
Watch the jobs (next section) and check the result.
Merge back. After a final release, merge the release branch into
mainanddev. After a maintenance release, merge the fix forward intodevif the bug is still there.Open the next version on dev. Before the tag,
pyproject.tomland_FALLBACK_VERSIONsay the number of the release, here2.0.0. After it, set both ondevto the version that comes next, with.dev0. A run seals the version it was made with, and a[[bug]]row covers the released versions, for exampleversions = ">=2.0.0a1,<=2.0.0rc1". A run ofdevthat still said2.0.0would carry for good a bug thatdevhas fixed.tests/unit/architecture/test_surfaces.pyfails when a row covers the version of the tree.
Changing a number#
A fix that moves a number of a run is allowed in a minor version and in a patch when the old number was wrong. It carries three things in the commit that makes it:
an entry under
NumbersinCHANGELOG.md, with the quantity and the size of the change, measured before and after. It is thetextof the row below, andpython -m tools.changes_changelog --writecopies it;a
[[bug]]row inhydromodpy/schema/changes.toml, with the versions it touches and the quantities it changes, so that a run stored before the fix reads asexploratory. A rule or a default that moves a number without a bug is a[[recipe]]of effectnumbersor a[[default]]row instead;the goldens it moves, under the rule of
tests/regression/README.md.
Moving a default is another thing: see the Defaults section of Versions and stability.
Moving a pinned binary#
HydroModPy downloads two native files at run time, and each one is pinned by a tag and by a sha256 per platform asset. A download that hashes to anything else is refused and never reaches the disk under its name.
What |
Where it is pinned |
|---|---|
MODFLOW executables and |
|
The HELP3O extension ( |
|
A new release is a number change until proven otherwise, because a new solver build can move a run even when no line of HydroModPy moved. So a bump is never a one-line change. It goes through these steps, in the commit that moves the pin:
Read the digests from GitHub, without a download:
gh api repos/MODFLOW-ORG/executables/releases/tags/<tag> \ --jq '.assets[] | [.name, .digest] | @tsv'
Write the tag and every digest in the table. A Python version or a platform the new tag adds goes in the table, and one it drops is refused from then on, so say so in the changelog.
Install the new binaries and run the regression tiers and the validation cases against them, with
tests/regression/README.md. Move a golden only with its stated reason, and update the versionstests/TOLERANCES.mdnames.Write the entry under
NumbersinCHANGELOG.md, with the old and new release and the size of the change, measured before and after. If nothing moved, the entry says that and names what was run. If a number moved, this is Changing a number, with its row inhydromodpy/schema/changes.toml.
A digest that changes while the tag stays is a new release too: the asset was
replaced upstream, so the same steps apply. An existing cache is never refreshed by
a bump. hmp install-binaries --upgrade is what moves a user to the new pin.
What the tag starts#
Release / PyPI (publish.yml), on a v*.*.* tag or a manual dispatch with
an existing tag:
builds the sdist and the wheel, and checks that the tag equals the
pyproject.tomlversion;installs the wheel in a clean environment and writes a CycloneDX SBOM;
uploads to PyPI through Trusted Publishing (OpenID Connect, no token);
creates the GitHub Release, with the changelog section as its body and the distributions and the SBOM attached. A tag of the form
vX.Y.ZaN,bNorrcNis marked as a pre-release.
Docs / Deploy Pages (multi-version) (docs-deploy-pages.yml) builds the
documentation of the pushed tag with a strict build and publishes it into its own
folder of docs.hydromodpy.fr. Folders already published are kept. The same job
rewrites switcher.json, the list the version menu of the site reads, from the
folders it finds on the gh-pages branch, with main marked as preferred.
Python installers ignore a pre-release unless asked, so users install one with
pip install --pre hydromodpy or by exact version. Pages for users never show
the flag or a version number. The number lives in pyproject.toml only.
Hotfix#
A regression in vX.Y.Z is fixed from the released tag: branch, apply the
minimal patch, and release vX.Y.(Z+1). A hotfix carries no feature. For an
older major line, branch from its maintenance branch (maint/1.x), which exists
only if maintenance of that line resumes.
After the release#
Check the version on https://pypi.org/p/hydromodpy and the new folder on the documentation site.
Check that
switcher.jsonlists the version.Start recording the next changes under
[Unreleased].