diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml index 2aa82b3..0d058a4 100644 --- a/.github/workflows/python-publish.yaml +++ b/.github/workflows/python-publish.yaml @@ -33,6 +33,7 @@ jobs: - name: Update package version run: | VERSION=${{ github.event.release.tag_name }} + sed -i 's/__version__ = ".*"/__version__ = "'${VERSION}'"/' _version.py sed -i "s/version='.*'/version='${VERSION}'/" setup.py - name: Build package run: python -m build diff --git a/datastew/__init__.py b/datastew/__init__.py index c408349..8984012 100644 --- a/datastew/__init__.py +++ b/datastew/__init__.py @@ -1,6 +1,7 @@ from .visualisation import * from .mapping import * from .embedding import * +from ._version import __version__ # Importing submodules to expose their attributes if needed from .process import mapping, parsing diff --git a/datastew/_version.py b/datastew/_version.py new file mode 100644 index 0000000..e5038cf --- /dev/null +++ b/datastew/_version.py @@ -0,0 +1 @@ +__version__ = "0.4.0" # will be substituted in publish workflow diff --git a/setup.py b/setup.py index 42d5ff0..b4ef56f 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import io import os + from setuptools import setup, find_packages DESCRIPTION = 'Intelligent data steward toolbox using Large Language Model embeddings for automated Data-Harmonization.' @@ -14,7 +15,7 @@ setup( name='datastew', - version='0.1.0', # will be substituted in publish workflow + version='0.4.0', # will be substituted in publish workflow packages=find_packages(), # This will automatically find all packages and sub-packages url='https://github.com/SCAI-BIO/datastew', license='Apache-2.0 license', diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 0000000..2b6bc6b --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,15 @@ +import re +from unittest import TestCase +import datastew + + +class Test(TestCase): + def test_canonical_version(self): + version = datastew.__version__ + return ( + re.match( + r"^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$", + version, + ) + is not None + )