Skip to content

Determine version with versioningit tool

Mateusz Żebrak requested to merge mzebrak/versioning into develop

This MR fixes hivemind versioning. Version is determined during the build stage and saved in the generated _version.py file.

This tool is similar to the setuptools-scm but offers more configuration options which were required in the hivemind use case.

Needed:

  • File-based versioning (write to the file)
  • Substitutions (commit sha)
  • Substitutions (commit timestamp)

A good comparison is available here: https://setuptools-git-versioning.readthedocs.io/en/latest/differences.html

Now it is possible to upload hivemind to the PyPI if the repository’s current state is an exact tag match (e.g. hivemind-1.25) because that tag will be strictly used as the hivemind version.

Before (including the current master) we wouldn't be able to upload this project to PyPI, as it forbids local version components.

Based on the current repository state - distance, dirty and distance-dirty are formatted to include the current commit sha and author-date.

[tool.versioningit.format]
distance = "{base_version}-{distance}+{vcs}{rev}.{author_date:%Y%m%dT%H%M%S}"
dirty = "{base_version}+{vcs}{rev}-dirty.{author_date:%Y%m%dT%H%M%S}"
distance-dirty = "{base_version}-{distance}+{vcs}{rev}-dirty.{author_date:%Y%m%dT%H%M%S}"
Edited by Mateusz Żebrak

Merge request reports

Loading