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

meson.build

version in project()

hand

pyproject.toml

dynamic field, no static copy

meson-python

CITATION.cff

version

Cog

codemeta.json

version

--write via gen_codemeta.py

pixi.toml

version in [workspace]

Cog

towncrier.toml

version in [tool.towncrier]

Cog

docs/source/Doxyfile_gpridge.cfg

PROJECT_NUMBER

Cog

fpm.toml

version

--write, checked

rust/gpridge-sys/Cargo.toml

version

--write, checked

rust/gpridge-sys/Cargo.lock

the gpridge-sys entry

--write, checked

julia/GPRidge.jl/Project.toml

version

--write, checked

r/gpridge/DESCRIPTION

Version

--write, checked

packaging/conda/recipe.yaml

version under context

--write, checked

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.

  1. Decide the version and edit the meson.build line. Set date-released in CITATION.cff, then run check_version_sot.py --write.

  2. Preview the changelog with towncrier build --draft. A build without --draft writes the section after the marker line in CHANGELOG.md and asks before it deletes the fragments; --yes skips the question and --keep keeps them. The section heading links to the tag vVERSION, so that link works only once the tag exists. If CHANGELOG.md already has a section for the version in towncrier.toml, a second build adds a second heading for the same version, so build only for a new version.

  3. Run check_version_sot.py and the test suites, and merge the release source into main.

  4. Tag the tested source vMAJOR.MINOR.PATCH. A tag with a suffix, such as v0.7.0-rc.6, is a candidate: it is built and tested and is never published.

  5. For a stable tag on a public repository, the publish job of .github/workflows/wheels.yml runs after the wheels and the source distribution have been built and installed in clean environments. It first runs scripts/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.