diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index d2d5993..70b3b2c 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -26,6 +26,8 @@ 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 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..0e58bba --- /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)