Skip to content

Commit

Permalink
fix circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhsmit committed Jan 2, 2023
1 parent 21effe9 commit 19be5bd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
12 changes: 1 addition & 11 deletions hdxms_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
11 changes: 11 additions & 0 deletions hdxms_datasets/__version__.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions hdxms_datasets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 19be5bd

Please sign in to comment.