diff --git a/qstack/__init__.py b/qstack/__init__.py index 71bb664..f9e7bb9 100644 --- a/qstack/__init__.py +++ b/qstack/__init__.py @@ -8,7 +8,12 @@ from qstack import spahm from qstack import mathutils from qstack import orcaio +from qstack import qml +if 'b2r2' not in dir(qml): + del qml + +# qstack.regression needs sklearn to work try: import sklearn except ImportError: diff --git a/qstack/qml.py b/qstack/qml.py new file mode 100644 index 0000000..3448825 --- /dev/null +++ b/qstack/qml.py @@ -0,0 +1,16 @@ +# qstack.qml is in a different python package +# but prefer "the local version of it" if we are in a development environment, and both sources are there. +import os +_qstack_qml_path = os.path.join(os.path.dirname(__file__), 'qstack-qml') +if os.path.isfile(os.path.join(_qstack_qml_path, 'qstack_qml', '__init__.py')): + import sys + sys.path.insert(0,_qstack_qml_path) + from qstack_qml import * + sys.path.pop(0) + del sys +else: + try: + from qstack_qml import * + except ImportError: + pass +del os, _qstack_qml_path