Nowadays, it is becoming popular to use a modern build system. Versioneer is my favourite of all versioning tools I've used, but unfortunately it is limited to setuptools, which is limiting me to move onto different build systems. I tried versioneer with hatch as follows:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "code"
path = "src/my_project/_version.py"
expression = "get_versions()['version']"
This was very straightforward so far. But the real problem is that versioneer doesn't provide a hook API to use for building sdist etc. and the _version.py needs to be replaced to a file with a constant when building!
This should be very easy to do with hooks:
https://hatch.pypa.io/latest/plugins/build-hook/reference/#hatchling.builders.hooks.plugin.interface.BuildHookInterface--hookspy
I appreciate your work on this project!
Nowadays, it is becoming popular to use a modern build system. Versioneer is my favourite of all versioning tools I've used, but unfortunately it is limited to setuptools, which is limiting me to move onto different build systems. I tried versioneer with
hatchas follows:This was very straightforward so far. But the real problem is that versioneer doesn't provide a hook API to use for building sdist etc. and the
_version.pyneeds to be replaced to a file with a constant when building!This should be very easy to do with hooks:
https://hatch.pypa.io/latest/plugins/build-hook/reference/#hatchling.builders.hooks.plugin.interface.BuildHookInterface--hookspy
I appreciate your work on this project!