Version and releases¶
Status: implemented. The version has one source, the version line of the
project() call in meson.build. Files that can hold a Cog block
get their copy generated from that line. The version fields of the native
package manifests are written by the same script. Cog also writes the
CITATION.cff version.
Bump the version¶
Edit the meson.build line, then run this command from the repository root:
pixi run --locked -e docs python scripts/check_version_sot.py --write
The script runs Cog over every tracked file that has a Cog block. Each block
calls scripts/project_version.py, which parses the meson.build line, and
Cog replaces the block’s output with the new version. With --write the
script also rewrites the native package version fields and regenerates
codemeta.json from CITATION.cff. Set date-released in CITATION.cff
before running this command for a release.
Copies of the version¶
File |
Field |
Written by |
|---|---|---|
|
|
hand |
|
dynamic field, no static copy |
meson-python |
|
|
Cog |
|
|
|
|
|
Cog |
|
|
Cog |
|
|
Cog |
|
|
|
|
|
|
|
the |
|
|
|
|
|
|
|
|
|
|
The checker also reads the version of a .zenodo.json when that file
exists. The repository has none, so the Zenodo deposit metadata is not
tracked.
The builds read the version when they configure. Meson writes
gpridge_version.h from meson.project_version(). The Python sdist and wheels take the same line:
pyproject.toml lists version under dynamic, and meson-python reads it
while it builds. Sphinx reads the meson.build line in docs/source/conf.py.
Check the copies¶
The workflow .github/workflows/version-sot.yml runs on every push and pull
request. Its steps are:
pixi run --locked -e docs python scripts/check_version_sot.py
python -m unittest discover -s tests/integration -p test_native_package_versions.py -v
python -m unittest discover -s tests/integration -p test_publish_artifacts.py -v
pixi run --locked -e docs towncrier build --draft
--locked makes pixi fail when pixi.lock does not match pixi.toml,
instead of solving the environment again. Without --write, the script runs
cog --check, which fails when a block would change. It compares the
version of CITATION.cff, of .zenodo.json when present, and of each
native manifest with the meson.build line. Then it searches every tracked
file for the version string. Lock files, UPSTREAM.md and the third-party
trees under subprojects/ and thirdparty/ give the versions of other
projects, so the search skips them. A match is allowed in Cog output, on the
meson.build line, in a version field listed above, in a published
changelog heading of the form ## [VERSION], or after a comparison operator
as in the dependency bound >=1.2. Any other match is a hand-written copy and
fails the check.
The two unit tests check the native manifests and the publication validation
described below. towncrier build --draft prints the release notes that the
fragments under docs/newsfragments/ would add for the towncrier.toml
version, and writes no file.
Release¶
A release moves the version, the changelog and the tag together. The steps below follow what the repository does; nothing in them is automatic apart from the checks and the publish job.
Decide the version and edit the
meson.buildline. Setdate-releasedinCITATION.cff, then runcheck_version_sot.py --write.Preview the changelog with
towncrier build --draft. A build without--draftwrites the section after the marker line inCHANGELOG.mdand asks before it deletes the fragments;--yesskips the question and--keepkeeps them. The section heading links to the tagvVERSION, so that link works only once the tag exists. IfCHANGELOG.mdalready has a section for the version intowncrier.toml, a second build adds a second heading for the same version, so build only for a new version.Run
check_version_sot.pyand the test suites, and merge the release source intomain.Tag the tested source
vMAJOR.MINOR.PATCH. A tag with a suffix, such asv0.7.0-rc.6, is a candidate: it is built and tested and is never published.For a stable tag on a public repository, the
publishjob of.github/workflows/wheels.ymlruns after the wheels and the source distribution have been built and installed in clean environments. It first runsscripts/check_publish_artifacts.py, which requires every distribution’s version to equal the tag, and then uploads to PyPI through Trusted Publishing.
The native packages (pkg-config and CMake, Fortran fpm, Rust, R, Julia and
conda) are built and tested by .github/workflows/native-registries.yml and
are not uploaded by any workflow. The archival steps that follow a release
are in Publishing software and reproduction records.