fix: use no-local-version scheme for clean semver display

Add local_scheme = "no-local-version" to setuptools-scm config so
versions never include the +g<hash> suffix. Simplify the regex in
__init__.py to only strip .post/.dev suffixes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-04-13 10:29:55 -04:00
parent 786df786b7
commit 3fdff403fc
2 changed files with 5 additions and 5 deletions

View File

@@ -8,11 +8,10 @@ try:
except _PackageNotFoundError:
_raw_version = "0.0.0"
# Clean setuptools-scm version for display:
# "2.0.post1.dev0+g05b5d6dc7.d20260214" → "2.0+g05b5d6dc7"
# "2.0.post1.dev1+g1234abc" → "2.0+g1234abc"
# "2.0" → "2.0"
__version__ = _re.sub(r"(\.post\d+\.dev\d+|\.d\d{8})", "", _raw_version)
# Clean setuptools-scm suffixes for display:
# "2.5.1.post1.dev0" → "2.5.1"
# "2.5.1" → "2.5.1"
__version__ = _re.sub(r"(\.post\d+|\.dev\d+)", "", _raw_version)
__version_tuple__ = tuple(
int(x) if x.isdigit() else x for x in __version__.split(".")
)

View File

@@ -31,6 +31,7 @@ hate_crack = [
[tool.setuptools_scm]
version_scheme = "no-guess-dev"
local_scheme = "no-local-version"
[tool.ruff]
exclude = [