Skip to content

Commit ee7a18b

Browse files
committed
Use versioningit for versioning
1 parent cd6a089 commit ee7a18b

File tree

6 files changed

+27
-3
lines changed

6 files changed

+27
-3
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*
22

3+
!.git
34
!*.py
45
!*.rst
56
!*.txt

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
=================

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV TERM=linux
1212

1313
# Install prerequisites
1414
RUN apt-get update
15-
RUN apt-get --yes install wget
15+
RUN apt-get --yes install git wget
1616

1717
# Configure build environment
1818
ENV PIP_ROOT_USER_ACTION=ignore

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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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.vcs]
9+
method = "git-archive"
10+
default-tag = "0.0.0"
11+
describe-subst = "$Format:%(describe:tags)$"
12+
113
[tool.ruff]
214
line-length = 100
315

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)