Skip to content

Commit 908f074

Browse files
committed
chore(package): dynamic version from git metadata
1 parent 4b918b8 commit 908f074

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from importlib.metadata import version, PackageNotFoundError
2+
3+
try:
4+
__version__ = version("conventional-pre-commit")
5+
except PackageNotFoundError:
6+
# package is not installed
7+
pass

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "conventional_pre_commit"
3-
version = "2.4.0"
3+
dynamic = ["version"]
44
description = "A pre-commit hook that checks commit messages for Conventional Commits formatting."
55
readme = "README.md"
66
license = { file = "LICENSE" }
@@ -24,13 +24,14 @@ dev = [
2424
"flake8",
2525
"pre-commit",
2626
"pytest",
27+
"setuptools_scm",
2728
]
2829

2930
[project.scripts]
3031
conventional-pre-commit = "conventional_pre_commit.hook:main"
3132

3233
[build-system]
33-
requires = ["setuptools>=64", "wheel"]
34+
requires = ["setuptools>=65", "setuptools-scm>=8"]
3435
build-backend = "setuptools.build_meta"
3536

3637
[tool.black]
@@ -51,3 +52,6 @@ norecursedirs = [
5152
".pytest_cache",
5253
".vscode",
5354
]
55+
56+
[tool.setuptools_scm]
57+
# intentionally left blank, but we need the section header to activate the tool

0 commit comments

Comments
 (0)