diff --git a/hdxms_datasets/__init__.py b/hdxms_datasets/__init__.py index 5c046d5..ed0d7c2 100644 --- a/hdxms_datasets/__init__.py +++ b/hdxms_datasets/__init__.py @@ -4,14 +4,4 @@ from hdxms_datasets.datasets import HDXDataSet from hdxms_datasets.config import cfg -# placeholder version number -__version__ = "0.0.0" - -# when we are on editable install from source, the _version file is present -# and we can get a version from there -try: - from . import _version - - __version__ = _version.get_versions()["version"] -except ImportError: - pass +from hdxms_datasets.__version__ import __version__ diff --git a/hdxms_datasets/__version__.py b/hdxms_datasets/__version__.py new file mode 100644 index 0000000..ea5dde7 --- /dev/null +++ b/hdxms_datasets/__version__.py @@ -0,0 +1,11 @@ +# placeholder version number +__version__ = "0.0.0" + +# when we are on editable install from source, the _version file is present +# and we can get a version from there +try: + from . import _version + + __version__ = _version.get_versions()["version"] +except ImportError: + pass diff --git a/hdxms_datasets/config.py b/hdxms_datasets/config.py index e769dd2..3ea66d1 100644 --- a/hdxms_datasets/config.py +++ b/hdxms_datasets/config.py @@ -6,16 +6,16 @@ from omegaconf import OmegaConf, DictConfig, DictKeyType from packaging import version -from hdxms_datasets._version import get_versions -__version__ = get_versions()["version"] -del get_versions +import hdxms_datasets def reset_config(): """Create a new config.yaml file in the user home dir/.hdxms_datasets folder""" with open(conf_home_pth, "w") as target: + from hdxms_datasets.__version__ import __version__ + version_string = "# HDXMS datasets configuration file " + __version__ + "\n\n" target.write(version_string) @@ -87,6 +87,8 @@ def valid_config() -> bool: with open(conf_home_pth, "r") as f: version_string = f.readline().strip("; ").split(" ")[-1] + from hdxms_datasets.__version__ import __version__ + hdxms_datasets_version = version.parse(__version__) cfg_version = version.parse(version_string)