Merge pull request #53 from cdtools-developers/version_source_of_truth

Add cdtools.__version__ and set it up so that there is a single source of truth for the version number
This commit is contained in:
Damian Guenzing
2025-10-29 21:34:33 -07:00
committed by GitHub
3 changed files with 14 additions and 1 deletions
+11 -1
View File
@@ -1,11 +1,21 @@
import setuptools
import os
import re
with open("README.md", "r") as fh:
long_description = fh.read()
# read version from src/cdtools/_version.py
version_file = os.path.join("src/cdtools", "_version.py")
with open(version_file) as f:
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
if not version_match:
raise RuntimeError("Unable to find version string.")
version = version_match.group(1)
setuptools.setup(
name="cdtools-py",
version="0.3.0",
version=version,
python_requires='>3.8', # recommended minimum version for pytorch 2.3.0
author="Abe Levitan",
author_email="abraham.levitan@psi.ch",
+2
View File
@@ -6,6 +6,8 @@ warnings.filterwarnings("ignore",
__all__ = ['tools', 'datasets', 'models', 'reconstructors']
from ._version import __version__
from cdtools import tools
from cdtools import datasets
from cdtools import models
+1
View File
@@ -0,0 +1 @@
__version__ = "0.3.1.dev"