diff --git a/.gitignore b/.gitignore index 5a92b6b..808420e 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +**/_version.py # PyInstaller # Usually these files are written by a python script from a template diff --git a/pyproject.toml b/pyproject.toml index 48d1d9a..0a1e6d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,12 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [tool.hatch.version] -path = "tango/pyaml/__init__.py" +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "tango/pyaml/_version.py" [tool.hatch.build.targets.sdist] exclude = [ diff --git a/tango/pyaml/__init__.py b/tango/pyaml/__init__.py index a459ed4..a73e0e9 100644 --- a/tango/pyaml/__init__.py +++ b/tango/pyaml/__init__.py @@ -1,8 +1,8 @@ -__version__ = "0.4.0" - import logging.config import os +from ._version import __version__ as __version__ + config_file = os.getenv("TANGO_PYAML_LOG_CONFIG", "tango_pyaml_logging.conf") if os.path.exists(config_file):