Skip to content

Commit

Permalink
Merge pull request #49 from SCAI-BIO/add-version-fn
Browse files Browse the repository at this point in the history
Add __version__ attribute
  • Loading branch information
tiadams authored Oct 30, 2024
2 parents 7a9a7b8 + bd1de0a commit 6307836
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions datastew/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions datastew/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.4.0" # will be substituted in publish workflow
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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.'
Expand All @@ -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',
Expand Down
15 changes: 15 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit 6307836

Please sign in to comment.