My pyproject.toml file contains:
[project]
name = "projecta"
dynamic = ["version"]
[build-system]
requires = ["setuptools >= 61.0",
"setuptools-scm >= 8.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
version_file = "projecta/_version.py"
Python 3.10.12
setuptools-scm==8.0.4
pip-tools==7.3.0
git version 2.34.1
$ git describe v0.1.9
$ git describe --tags v0.1.9
What gets created from 'python -m build' is:
projecta-0.1.10.dev0+gf3c0ecd.d20240214-py3-none-any.whl
How is the version determined? The patch generated does not match what is in the latest tag.
I tried adding new tags: git tag -a . Nothing produces a build that matches the latest tag. I tried looking through git output to find a version that matches what build is producing and have not found anything that matches. I committed all changes and then added a new tag. Still getting a newer version than specified along with devx on all built versions.
See setuptools-scm's documentation Default versioning scheme: The version you've got follows the format:
{next_version}.dev{distance}+{scm letter}{revision hash}.dYYYYMMDD
You should stash your uncommitted changes and eventually checkout the tag if you have any distance (committed changes after the tag). In your case, you don't need to checkout explicitly the tag, as the distance is 0, so you don't have any committed changes after the tag.
git stash
git checkout v0.1.9
python -m setuptools_scm