Skip to content

Commit 0f26990

Browse files
committed
Use versioningit for versioning
1 parent cd6a089 commit 0f26990

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ grafana-wtf changelog
55

66
in progress
77
===========
8+
- Started using ``versioningit`` for versioning
89

910
2025-02-04 0.22.0
1011
=================

grafana_wtf/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
"""grafana-wtf: Grep through all Grafana entities"""
2+
try:
3+
from importlib.metadata import PackageNotFoundError, version
4+
except (ImportError, ModuleNotFoundError): # pragma:nocover
5+
from importlib_metadata import PackageNotFoundError, version # type: ignore[assignment,no-redef,unused-ignore]
26

37
__appname__ = "grafana-wtf"
4-
__version__ = "0.22.0"
8+
9+
try:
10+
__version__ = version(__appname__)
11+
except PackageNotFoundError: # pragma: no cover
12+
__version__ = "unknown"

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = [
4+
"setuptools>=42", # At least v42 of setuptools required.
5+
"versioningit",
6+
]
7+
8+
[tool.versioningit.onbuild]
9+
10+
[tool.versioningit.vcs]
11+
method = "git-archive"
12+
default-tag = "0.0.0"
13+
describe-subst = "$Format:%(describe:tags)$"
14+
115
[tool.ruff]
216
line-length = 100
317

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33

44
from setuptools import find_packages, setup
5+
from versioningit import get_cmdclasses
56

67
here = os.path.abspath(os.path.dirname(__file__))
78
README = open(os.path.join(here, "README.rst")).read()
@@ -14,6 +15,7 @@
1415
# Core
1516
"six",
1617
"docopt-ng>=0.6.2,<0.10",
18+
"importlib-metadata; python_version<'3.8'",
1719
"munch>=2.5.0,<5",
1820
"tqdm>=4.60.0,<5",
1921
"verlib2>=0.3.1,<0.4",
@@ -43,7 +45,7 @@
4345

4446
setup(
4547
name="grafana-wtf",
46-
version="0.22.0",
48+
cmdclass=get_cmdclasses(),
4749
description="Grep through all Grafana entities in the spirit of git-wtf",
4850
long_description=README,
4951
license="AGPL 3, EUPL 1.2",

0 commit comments

Comments
 (0)