diff --git a/src/rdkit_descriptors.py b/src/rdkit_descriptors.py index 6d21a0f..5a7a5cb 100644 --- a/src/rdkit_descriptors.py +++ b/src/rdkit_descriptors.py @@ -64,12 +64,13 @@ import NP_Score from NP_Score import npscorer -# this is pretty gross, but we need to be able to import utils both when -# running as part of the node/package and when running the test suite +# Relative import first: extensions share a Python gateway's sys.path, so a bare +# `import utils` can bind another extension's top-level utils module. The fallback +# covers the test suite, which runs these modules without package context. try: - import utils -except ImportError: from . import utils +except ImportError: + import utils LOGGER = logging.getLogger(__name__) diff --git a/src/standardizer_parent.py b/src/standardizer_parent.py index 89ac460..cd93f43 100644 --- a/src/standardizer_parent.py +++ b/src/standardizer_parent.py @@ -53,12 +53,13 @@ import knime.extension as knext from rdkit import Chem -# this is pretty gross, but we need to be able to import utils both when -# running as part of the node/package and when running the test suite +# Relative import first: extensions share a Python gateway's sys.path, so a bare +# `import utils` can bind another extension's top-level utils module. The fallback +# covers the test suite, which runs these modules without package context. try: - import utils -except ImportError: from . import utils +except ImportError: + import utils import logging diff --git a/src/stereoisomer_enumeration.py b/src/stereoisomer_enumeration.py index 016b3b9..0729e44 100644 --- a/src/stereoisomer_enumeration.py +++ b/src/stereoisomer_enumeration.py @@ -56,12 +56,13 @@ import numpy as np LOGGER = logging.getLogger(__name__) -# this is pretty gross, but we need to be able to import utils both when -# running as part of the node/package and when running the test suite +# Relative import first: extensions share a Python gateway's sys.path, so a bare +# `import utils` can bind another extension's top-level utils module. The fallback +# covers the test suite, which runs these modules without package context. try: - import utils -except ImportError: from . import utils +except ImportError: + import utils @knext.node( name="Stereoisomer Enumeration",