diff --git a/bilby_lisa/__init__.py b/bilby_lisa/__init__.py index ee53be1..acf42a5 100644 --- a/bilby_lisa/__init__.py +++ b/bilby_lisa/__init__.py @@ -6,26 +6,3 @@ from ._version import version as __version__ except ModuleNotFoundError: # development mode __version__ = "unknown" - -import bilby -import bilby_pipe -import parallel_bilby - -# check the bilby, bilby_pipe and parallel_bilby installations -error_str = ( - "`bilby_lisa` currently requires a non-released version of `{}` " - "(you have {} installed currently). Please read the README.md file " - "in the source repository for full installation instructions" -) -if "f027394" not in bilby.__version__: - raise ImportError( - error_str.format('bilby', bilby.__version__) - ) -if "581eb9a" not in bilby_pipe.__version__: - raise ImportError( - error_str.format('bilby_pipe', bilby_pipe.__version__) - ) -if "e4e2f7b" not in parallel_bilby.__version__: - raise ImportError( - error_str.format('parallel_bilby', parallel_bilby.__version__) - ) diff --git a/bilby_lisa/bilby_pipe.py b/bilby_lisa/bilby_pipe.py index 3318c15..1e84498 100644 --- a/bilby_lisa/bilby_pipe.py +++ b/bilby_lisa/bilby_pipe.py @@ -245,6 +245,17 @@ def bilby_pipe_main(): """A modified, top-level interface for bilby_pipe which first checks the `bilby_lisa` installation """ - from .utils import get_version_info + from .utils import get_version_info, version_error_string + import bilby + import bilby_pipe + get_version_info() + if "f027394" not in bilby.__version__: + raise ImportError( + version_error_string.format('bilby', bilby.__version__) + ) + if "581eb9a" not in bilby_pipe.__version__: + raise ImportError( + version_error_string.format('bilby_pipe', bilby_pipe.__version__) + ) main() diff --git a/bilby_lisa/parallel_bilby.py b/bilby_lisa/parallel_bilby.py index 71d8bb5..fee4a0a 100644 --- a/bilby_lisa/parallel_bilby.py +++ b/bilby_lisa/parallel_bilby.py @@ -39,6 +39,14 @@ def parallel_bilby_generation_main(): """A modified, top-level interface for parallel_bilby_generation which first checks the `bilby_lisa` installation """ - from .utils import get_version_info + from .utils import get_version_info, version_error_string + import parallel_bilby + get_version_info() + if "e4e2f7b" not in parallel_bilby.__version__: + raise ImportError( + version_error_string.format( + 'parallel_bilby', parallel_bilby.__version__ + ) + ) main() diff --git a/bilby_lisa/utils.py b/bilby_lisa/utils.py index b645267..bf1881f 100644 --- a/bilby_lisa/utils.py +++ b/bilby_lisa/utils.py @@ -3,6 +3,11 @@ from bilby_pipe.utils import logger __author__ = ["Charlie Hoy "] +version_error_string = ( + "`bilby_lisa` currently requires a non-released version of `{}` " + "(you have {} installed currently). Please read the README.md file " + "in the source repository for full installation instructions" +) def get_warning(): diff --git a/pyproject.toml b/pyproject.toml index b2ea9c0..d8bc7d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,11 +27,13 @@ requires-python = ">=3.9" dependencies = [ "bilby", "bilby_pipe", - "parallel_bilby" ] dynamic = ["version"] [project.optional-dependencies] +parallel = [ + "parallel_bilby" +] docs = [ "Sphinx >=1.2.2", "sphinx-immaterial",