diff --git a/FastGeodis/__init__.py b/FastGeodis/__init__.py index e4e0cc8..b7e5db4 100644 --- a/FastGeodis/__init__.py +++ b/FastGeodis/__init__.py @@ -30,6 +30,7 @@ from typing import List import torch +from _version import __version__ import FastGeodisCpp diff --git a/setup.py b/setup.py index 73de3c0..5e0baa3 100755 --- a/setup.py +++ b/setup.py @@ -113,6 +113,21 @@ def get_extensions(): ] return ext_modules +def get_version(): + # following guidance from: https://stackoverflow.com/a/7071358 + VERSIONFILE="FastGeodis/_version.py" + verstrline = open(VERSIONFILE, "rt").read() + VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" + mo = re.search(VSRE, verstrline, re.M) + if mo: + verstr = mo.group(1) + else: + raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,)) + return verstr + +# get current version +version = get_version() +print(f"FastGeodis building version: {version}") with open("README.md", "r") as fh: long_description = fh.read() @@ -125,7 +140,7 @@ def get_extensions(): setup( name="FastGeodis", - version="1.0.4", + version=version, description="Fast Implementation of Generalised Geodesic Distance Transform for CPU (OpenMP) and GPU (CUDA)", long_description=long_description, long_description_content_type="text/markdown",