From 093f945586ba54eca9028a8e19cb166edc1aa456 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 4 Dec 2025 14:22:40 +0100 Subject: [PATCH 1/3] Get version from git tag --- binder/environment.yml | 1 + pyproject.toml | 24 +++++++++++++++++++++- src/python_workflow_definition/__init__.py | 4 ++++ src/python_workflow_definition/_version.py | 21 +++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/python_workflow_definition/_version.py diff --git a/binder/environment.yml b/binder/environment.yml index 357b297..c0c58a5 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -5,6 +5,7 @@ dependencies: - click =8.1.8 - pydantic =2.12.4 - hatchling =1.27.0 +- hatch-vcs =0.5.0 - httpcore =1.0.7 - jobflow =0.2.1 - pyiron_base =0.15.10 diff --git a/pyproject.toml b/pyproject.toml index e6dbe50..e363ebf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "hatchling.build" [project] name = "python_workflow_definition" -version = "0.1.2" description = "Python Workflow Definition - workflow interoperability for aiida, jobflow and pyiron" authors = [ { name = "Jan Janssen", email = "janssen@mpie.de" }, @@ -19,6 +18,7 @@ dependencies = [ "numpy>=1.21", "pydantic>=2.7.0,<=2.12.4", ] +dynamic = ["version"] [project.optional-dependencies] aiida = [ @@ -35,3 +35,25 @@ plot = [ "networkx>=2.8.8,<=3.5", "ipython>=7.33.0,<=9.8.0", ] + +[tool.hatch.build] +include = [ + "src/python_workflow_definition" +] + +[tool.hatch.build.hooks.vcs] +version-file = "src/python_workflow_definition/_version.py" + +[tool.hatch.build.targets.sdist] +include = [ + "src/python_workflow_definition" +] + +[tool.hatch.build.targets.wheel] +packages = [ + "src/python_workflow_definition" +] + +[tool.hatch.version] +source = "vcs" +path = "src/python_workflow_definition/_version.py" \ No newline at end of file diff --git a/src/python_workflow_definition/__init__.py b/src/python_workflow_definition/__init__.py index e69de29..0d69772 100644 --- a/src/python_workflow_definition/__init__.py +++ b/src/python_workflow_definition/__init__.py @@ -0,0 +1,4 @@ +import python_workflow_definition._version + + +__version__ = python_workflow_definition._version.__version__ diff --git a/src/python_workflow_definition/_version.py b/src/python_workflow_definition/_version.py new file mode 100644 index 0000000..8e2b4a9 --- /dev/null +++ b/src/python_workflow_definition/_version.py @@ -0,0 +1,21 @@ +# file generated by setuptools-scm +# don't change, don't track in version control + +__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"] + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple + from typing import Union + + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = "0.0.1" +__version_tuple__ = version_tuple = (0, 0, 1) \ No newline at end of file From f0f14c8aaca736573966e6af6097a9d7a7d9d5a5 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 4 Dec 2025 14:24:30 +0100 Subject: [PATCH 2/3] Fix tracking files --- .github/workflows/pypi.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index e7013db..5c52548 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -26,7 +26,9 @@ jobs: environment-file: binder/environment.yml - name: Build shell: bash -l {0} - run: hatchling build -t sdist -t wheel + run: | + git update-index --assume-unchanged src/python_workflow_definition/_version.py + hatchling build -t sdist -t wheel - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From 1c08a70a521511a3680d098a6f467745c9f155d7 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 4 Dec 2025 14:31:09 +0100 Subject: [PATCH 3/3] black fix --- src/python_workflow_definition/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_workflow_definition/_version.py b/src/python_workflow_definition/_version.py index 8e2b4a9..0e58bba 100644 --- a/src/python_workflow_definition/_version.py +++ b/src/python_workflow_definition/_version.py @@ -18,4 +18,4 @@ version_tuple: VERSION_TUPLE __version__ = version = "0.0.1" -__version_tuple__ = version_tuple = (0, 0, 1) \ No newline at end of file +__version_tuple__ = version_tuple = (0, 0, 1)