diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..7c51009 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,3 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a7b00 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst diff --git a/.github/workflows/data-validation.yml b/.github/workflows/data-validation.yml index d7143c0..4fad100 100644 --- a/.github/workflows/data-validation.yml +++ b/.github/workflows/data-validation.yml @@ -16,6 +16,9 @@ jobs: HATCH_VERBOSE: 1 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # hatch-vcs needs the tag history to derive the version + filter: blob:none # full history is only needed for tags; skip the heavy data blobs - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1502ab7..f3fd1d8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,6 +21,9 @@ jobs: HATCH_VERBOSE: 1 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # hatch-vcs needs the tag history to derive the version + filter: blob:none # full history is only needed for tags; skip the heavy data blobs - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/pyproject.toml b/pyproject.toml index b941928..5f15ed9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] build-backend = "hatchling.build" -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] [project] authors = [{ name = "Bas des Tombe", email = "bas.des.tombe@pwn.nl" }] @@ -16,13 +16,13 @@ classifiers = [ "Topic :: Utilities", ] description = "Data part of the NHFLO modeling environment owned by HHNK, Artesia, and PWN." +dynamic = ["version"] keywords = ["NHFLO"] license = { file = "LICENSE.txt" } maintainers = [{ name = "Bas des Tombe", email = "bas.des.tombe@pwn.nl" }] name = "nhflodata" readme = "README.md" requires-python = ">=3.14" -version = "1.2.0" dependencies = ["pyyaml>=6.0.1"] @@ -39,6 +39,9 @@ test = [ "yamllint", ] +[tool.hatch.version] +source = "vcs" + [tool.hatch.envs.default] installer = "uv" python = "3.14" diff --git a/src/nhflodata/__init__.py b/src/nhflodata/__init__.py index 0323efb..c332c4a 100644 --- a/src/nhflodata/__init__.py +++ b/src/nhflodata/__init__.py @@ -1,4 +1,8 @@ """Utilities for working with NHFLO data.""" # ruff: noqa: F401 +from importlib.metadata import version + from nhflodata.get_paths import create_new_dataset, get_abs_data_path + +__version__ = version("nhflodata")