Version number management#
As explained in Code organization, the metatensor git repository contains multiple packages — each with its own version number — for multiple languages — each with their own way of managing versions numbers. This page explains how we handle versions and how to update version number for a release.
The core idea is that the version number stored in source file will always be the last released version, and when handling development versions we dynamically change this version number if necessary.
The overall sources of truth for version numbers are:
- the - versionfield in- metatensor-core/Cargo.tomlfor- metatensor-coreC, C++ API and Python API.
- the - versionfield in- metatensor/Cargo.tomlfor the- metatensorRust crate.
- the - VERSIONfile in- metatensor-torch/for- metatensor-coreC++ and Python API.
- the - METATENSOR_OPERATIONS_VERSIONvariable in- python/metatensor-operations/setup.pyfor the- metatensor-operationsPython package.
- the - METATENSOR_VERSIONvariable in- setup.pyfor the- metatensorPython package.
When doing a build from a git checkout, we use
scripts/n-commits-since-last-tag.sh to determine the number of commits since
the last tag matching the current package. If there where no commits since the
last tag, the version number from the list above is kept as-is. If there where
commits, the version number if updated, and a dev<X> suffix is added to
indicate this is a development version.
Doing a release#
When doing a release of any of the packages, the first step is to determine the
new version number using semantic versioning rules. Then, you should update
the version number at the right location from the list above. Finally, you
should add a tag on the corresponding commit, following this naming convention
(replacing <x.y.z> with the new version number).
- metatensor-core-v<x.y.z>for releases of- metatensor-core;
- metatensor-torch-v<x.y.z>for releases of- metatensor-torch;
- metatensor-python-v<x.y.z>for releases of the Python- metatensorpackage;
- metatensor-operations-v<x.y.z>for releases of the Python- metatensor-operationspackage;
- metatensor-rust-v<x.y.z>for releases of the Rust- metatensorcrate;
When releasing multiple packages at the same time, the corresponding commit will have multiple tags.