Skip to content

Commit

Permalink
add code to get version, fix OS classifier in pyproject.toml, don't w…
Browse files Browse the repository at this point in the history
…rite _version.py file
  • Loading branch information
tykling committed Dec 13, 2023
1 parent f0b7030 commit f6a3b47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions gstat_exporter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from prometheus_client import start_http_server, Gauge # type: ignore
from subprocess import Popen, PIPE
from typing import Dict
from importlib.metadata import PackageNotFoundError, version

# get version
try:
__version__ = version("gstat_exporter")
except PackageNotFoundError:
# package is not installed, version unknown
__version__ = "0.0.0"


def get_deviceinfo(name: str) -> Dict[str, str]:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Operating System :: FreeBSD",
"Operating System :: POSIX :: BSD :: FreeBSD",
]

dependencies = [
Expand All @@ -35,4 +35,3 @@ dev = ["twine == 4.0.2", "pre-commit == 3.5.0", "setuptools-scm == 8.0.4", "buil
homepage = "https://github.com/tykling/gstat_exporter"

[tool.setuptools_scm]
version_file = "_version.py"

0 comments on commit f6a3b47

Please sign in to comment.