diff --git a/python/rascaline-torch/rascaline/torch/utils.py b/python/rascaline-torch/rascaline/torch/utils.py deleted file mode 100644 index 96bce84d6..000000000 --- a/python/rascaline-torch/rascaline/torch/utils.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - -import metatensor.torch - -import rascaline - - -_HERE = os.path.realpath(os.path.dirname(__file__)) - -_rascaline_torch_cmake_prefix = os.path.join(os.path.dirname(__file__), "lib", "cmake") - -cmake_prefix_path = ";".join( - [ - _rascaline_torch_cmake_prefix, - rascaline.utils.cmake_prefix_path, - metatensor.torch.utils.cmake_prefix_path, - ] -) -""" -Path containing the CMake configuration files for the underlying C library -""" diff --git a/python/rascaline-torch/rascaline/torch/utils/__init__.py b/python/rascaline-torch/rascaline/torch/utils/__init__.py index bc31628b9..3a73c2d20 100644 --- a/python/rascaline-torch/rascaline/torch/utils/__init__.py +++ b/python/rascaline-torch/rascaline/torch/utils/__init__.py @@ -1,4 +1,13 @@ +import os + from .power_spectrum import PowerSpectrum +_HERE = os.path.dirname(__file__) + +cmake_prefix_path = os.path.realpath(os.path.join(_HERE, "..", "lib", "cmake")) +""" +Path containing the CMake configuration files for the underlying C library +""" + __all__ = ["PowerSpectrum"] diff --git a/python/rascaline-torch/setup.py b/python/rascaline-torch/setup.py index dcce11623..0d357482e 100644 --- a/python/rascaline-torch/setup.py +++ b/python/rascaline-torch/setup.py @@ -38,6 +38,7 @@ class cmake_ext(build_ext): """Build the native library using cmake""" def run(self): + import metatensor import metatensor.torch import torch @@ -52,6 +53,7 @@ def run(self): # Tell CMake where to find rascaline & torch cmake_prefix_path = [ rascaline.utils.cmake_prefix_path, + metatensor.utils.cmake_prefix_path, metatensor.torch.utils.cmake_prefix_path, torch.utils.cmake_prefix_path, ] diff --git a/python/rascaline-torch/tests/utils/cmake_prefix.py b/python/rascaline-torch/tests/utils/cmake_prefix.py new file mode 100644 index 000000000..d6172a3bb --- /dev/null +++ b/python/rascaline-torch/tests/utils/cmake_prefix.py @@ -0,0 +1,7 @@ +import os + +import rascaline.torch + + +def test_cmake_prefix(): + assert os.path.exists(rascaline.torch.utils.cmake_prefix_path) diff --git a/python/rascaline/rascaline/utils/__init__.py b/python/rascaline/rascaline/utils/__init__.py index b5e6221e0..8f0f588a8 100644 --- a/python/rascaline/rascaline/utils/__init__.py +++ b/python/rascaline/rascaline/utils/__init__.py @@ -1,7 +1,5 @@ import os -import metatensor - from .power_spectrum import PowerSpectrum # noqa from .splines import ( # noqa AtomicDensityBase, @@ -19,11 +17,9 @@ ) -# path that can be used with cmake to access the rascaline library and headers -_HERE = os.path.realpath(os.path.dirname(__file__)) +_HERE = os.path.dirname(__file__) -_rascaline_cmake_prefix = os.path.realpath(os.path.join(_HERE, "..", "lib", "cmake")) -cmake_prefix_path = f"{_rascaline_cmake_prefix};{metatensor.utils.cmake_prefix_path}" +cmake_prefix_path = os.path.realpath(os.path.join(_HERE, "..", "lib", "cmake")) """ Path containing the CMake configuration files for the underlying C library """