From 320baa557c113eaa57a62581f7ec6f7fd17f45ba Mon Sep 17 00:00:00 2001 From: Guillaume Fraux Date: Tue, 19 Sep 2023 14:25:18 +0200 Subject: [PATCH] Update metatensor --- docs/requirements.txt | 2 +- pyproject.toml | 2 +- python/rascaline-torch/pyproject.toml | 2 +- python/rascaline/examples/property-selection.py | 2 +- python/rascaline/rascaline/_c_api.py | 6 +++--- python/rascaline/rascaline/_c_lib.py | 4 ++-- python/rascaline/rascaline/calculator_base.py | 4 ++-- python/rascaline/rascaline/utils/__init__.py | 6 ++---- python/rascaline/rascaline/utils/power_spectrum/_classes.py | 2 +- python/rascaline/tests/calculators/keys_selection.py | 2 +- python/rascaline/tests/calculators/properties_selection.py | 2 +- python/rascaline/tests/calculators/sample_selection.py | 2 +- python/scripts/generate-declarations.py | 6 +++--- rascaline-c-api/CMakeLists.txt | 4 ++-- rascaline-c-api/Cargo.toml | 4 ++-- rascaline-torch/CMakeLists.txt | 4 ++-- rascaline/Cargo.toml | 2 +- tox.ini | 4 ++-- 18 files changed, 29 insertions(+), 31 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index d5253562f..6047c6435 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -10,7 +10,7 @@ myst-parser # markdown => rst translation, used in extensions/rascaline_json # dependencies for the tutorials --extra-index-url https://download.pytorch.org/whl/cpu -metatensor[torch] @ https://github.com/lab-cosmo/metatensor/archive/d97ea65.zip +metatensor[torch] @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip torch chemfiles matplotlib diff --git a/pyproject.toml b/pyproject.toml index 66f43c20a..f436d2495 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] dependencies = [ - "metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/d97ea65.zip#subdirectory=python/metatensor-core", + "metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip#subdirectory=python/metatensor-core", ] [project.urls] diff --git a/python/rascaline-torch/pyproject.toml b/python/rascaline-torch/pyproject.toml index b588cb504..2769faa93 100644 --- a/python/rascaline-torch/pyproject.toml +++ b/python/rascaline-torch/pyproject.toml @@ -38,7 +38,7 @@ requires = [ "wheel >=0.38", "cmake", "torch >= 1.11", - "metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/d97ea65.zip#subdirectory=python/metatensor-torch", + "metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip#subdirectory=python/metatensor-torch", ] # use a custom build backend to add a dependency on the right version of rascaline diff --git a/python/rascaline/examples/property-selection.py b/python/rascaline/examples/property-selection.py index ff128bf64..4353af90c 100644 --- a/python/rascaline/examples/property-selection.py +++ b/python/rascaline/examples/property-selection.py @@ -6,7 +6,7 @@ """ import chemfiles import numpy as np -from metatensor.core import Labels, MetatensorError, TensorBlock, TensorMap +from metatensor import Labels, MetatensorError, TensorBlock, TensorMap from skmatter.feature_selection import FPS from rascaline import SoapPowerSpectrum diff --git a/python/rascaline/rascaline/_c_api.py b/python/rascaline/rascaline/_c_api.py index 6d7b43666..94febba84 100644 --- a/python/rascaline/rascaline/_c_api.py +++ b/python/rascaline/rascaline/_c_api.py @@ -7,7 +7,7 @@ import platform from ctypes import CFUNCTYPE, POINTER -from metatensor.core._c_api import mts_labels_t, mts_tensormap_t +from metatensor._c_api import mts_labels_t, mts_tensormap_t from numpy.ctypeslib import ndpointer @@ -85,7 +85,7 @@ def setup_functions(lib): from .status import _check_rascal_status_t lib.rascal_last_error.argtypes = [ - + ] lib.rascal_last_error.restype = ctypes.c_char_p @@ -149,7 +149,7 @@ def setup_functions(lib): lib.rascal_calculator_compute.restype = _check_rascal_status_t lib.rascal_profiling_clear.argtypes = [ - + ] lib.rascal_profiling_clear.restype = _check_rascal_status_t diff --git a/python/rascaline/rascaline/_c_lib.py b/python/rascaline/rascaline/_c_lib.py index 9fee81c62..f51269c19 100644 --- a/python/rascaline/rascaline/_c_lib.py +++ b/python/rascaline/rascaline/_c_lib.py @@ -2,7 +2,7 @@ import sys from ctypes import cdll -import metatensor.core +import metatensor from ._c_api import setup_functions from .log import _set_logging_callback_impl, default_logging_callback @@ -19,7 +19,7 @@ def __call__(self): if self._cached_dll is None: # Load metatensor shared library in the process first, to ensure # the rascaline shared library can find it - metatensor.core._c_lib._get_library() + metatensor._c_lib._get_library() path = _lib_path() diff --git a/python/rascaline/rascaline/calculator_base.py b/python/rascaline/rascaline/calculator_base.py index 404ee9186..a0949d31b 100644 --- a/python/rascaline/rascaline/calculator_base.py +++ b/python/rascaline/rascaline/calculator_base.py @@ -1,8 +1,8 @@ import ctypes from typing import List, Optional, Union -from metatensor.core import Labels, TensorMap -from metatensor.core._c_api import c_uintptr_t, mts_tensormap_t +from metatensor import Labels, TensorMap +from metatensor._c_api import c_uintptr_t, mts_tensormap_t from ._c_api import ( RASCAL_BUFFER_SIZE_ERROR, diff --git a/python/rascaline/rascaline/utils/__init__.py b/python/rascaline/rascaline/utils/__init__.py index 1bc546e1a..1d5ab3774 100644 --- a/python/rascaline/rascaline/utils/__init__.py +++ b/python/rascaline/rascaline/utils/__init__.py @@ -1,6 +1,6 @@ import os -import metatensor.core +import metatensor from .power_spectrum import PowerSpectrum @@ -12,9 +12,7 @@ _HERE = os.path.realpath(os.path.dirname(__file__)) _rascaline_cmake_prefix = os.path.realpath(os.path.join(_HERE, "..", "lib", "cmake")) -cmake_prefix_path = ( - f"{_rascaline_cmake_prefix};{metatensor.core.utils.cmake_prefix_path}" -) +cmake_prefix_path = f"{_rascaline_cmake_prefix};{metatensor.utils.cmake_prefix_path}" """ Path containing the CMake configuration files for the underlying C library """ diff --git a/python/rascaline/rascaline/utils/power_spectrum/_classes.py b/python/rascaline/rascaline/utils/power_spectrum/_classes.py index 4d93dbc53..01ea036d2 100644 --- a/python/rascaline/rascaline/utils/power_spectrum/_classes.py +++ b/python/rascaline/rascaline/utils/power_spectrum/_classes.py @@ -1,4 +1,4 @@ -from metatensor.core import Labels, TensorBlock, TensorMap +from metatensor import Labels, TensorBlock, TensorMap from ...calculator_base import CalculatorBase from ...systems import IntoSystem diff --git a/python/rascaline/tests/calculators/keys_selection.py b/python/rascaline/tests/calculators/keys_selection.py index a66b65d2b..f0c36c53e 100644 --- a/python/rascaline/tests/calculators/keys_selection.py +++ b/python/rascaline/tests/calculators/keys_selection.py @@ -1,6 +1,6 @@ import numpy as np import pytest -from metatensor.core import Labels, TensorBlock, TensorMap +from metatensor import Labels, TensorBlock, TensorMap from rascaline import RascalError from rascaline.calculators import DummyCalculator diff --git a/python/rascaline/tests/calculators/properties_selection.py b/python/rascaline/tests/calculators/properties_selection.py index b50abcf65..8b0292130 100644 --- a/python/rascaline/tests/calculators/properties_selection.py +++ b/python/rascaline/tests/calculators/properties_selection.py @@ -1,6 +1,6 @@ import numpy as np import pytest -from metatensor.core import Labels, TensorBlock, TensorMap +from metatensor import Labels, TensorBlock, TensorMap from rascaline import RascalError from rascaline.calculators import DummyCalculator diff --git a/python/rascaline/tests/calculators/sample_selection.py b/python/rascaline/tests/calculators/sample_selection.py index 97abc5ccc..33a9661d7 100644 --- a/python/rascaline/tests/calculators/sample_selection.py +++ b/python/rascaline/tests/calculators/sample_selection.py @@ -1,6 +1,6 @@ import numpy as np import pytest -from metatensor.core import Labels, TensorBlock, TensorMap +from metatensor import Labels, TensorBlock, TensorMap from rascaline import RascalError from rascaline.calculators import DummyCalculator diff --git a/python/scripts/generate-declarations.py b/python/scripts/generate-declarations.py index 7af4507db..189feb7c1 100755 --- a/python/scripts/generate-declarations.py +++ b/python/scripts/generate-declarations.py @@ -1,14 +1,14 @@ #!/usr/bin/env python import os -import metatensor.core +import metatensor from pycparser import c_ast, parse_file ROOT = os.path.dirname(__file__) FAKE_INCLUDES = os.path.join(ROOT, "include") METATENSOR_INCLUDE = os.path.join( - metatensor.core.utils.cmake_prefix_path, "..", "..", "include" + metatensor.utils.cmake_prefix_path, "..", "..", "include" ) RASCALINE_HEADER = os.path.relpath( os.path.join(ROOT, "..", "..", "rascaline-c-api", "include", "rascaline.h") @@ -248,7 +248,7 @@ def generate_declarations(): import platform from ctypes import CFUNCTYPE, POINTER -from metatensor.core._c_api import mts_labels_t, mts_tensormap_t +from metatensor._c_api import mts_labels_t, mts_tensormap_t from numpy.ctypeslib import ndpointer diff --git a/rascaline-c-api/CMakeLists.txt b/rascaline-c-api/CMakeLists.txt index db90e4b95..e4e340076 100644 --- a/rascaline-c-api/CMakeLists.txt +++ b/rascaline-c-api/CMakeLists.txt @@ -217,7 +217,7 @@ endif() # ============================================================================ # # Setup metatensor -set(METATENSOR_GIT_VERSION "d97ea65") +set(METATENSOR_GIT_VERSION "2248a3c") set(METATENSOR_REQUIRED_VERSION "0.1") if (RASCALINE_FETCH_METATENSOR) message(STATUS "Fetching metatensor @ ${METATENSOR_GIT_VERSION} from github") @@ -226,7 +226,7 @@ if (RASCALINE_FETCH_METATENSOR) FetchContent_Declare( metatensor URL https://github.com/lab-cosmo/metatensor/archive/${METATENSOR_GIT_VERSION}.zip - URL_HASH MD5=6a6899779591ae15861bb3547c7c354b + URL_HASH MD5=50e70a2e74246a985e1520260a74205c SOURCE_SUBDIR metatensor-core VERBOSE ) diff --git a/rascaline-c-api/Cargo.toml b/rascaline-c-api/Cargo.toml index 59e195a0f..0521fec19 100644 --- a/rascaline-c-api/Cargo.toml +++ b/rascaline-c-api/Cargo.toml @@ -18,7 +18,7 @@ chemfiles = ["rascaline/chemfiles"] [dependencies] rascaline = {path = "../rascaline", version = "0.1.0", default-features = false} -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "d97ea65"} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c"} ndarray = "0.15" log = { version = "0.4", features = ["std"] } @@ -29,7 +29,7 @@ libc = "0.2" [build-dependencies] cbindgen = { version = "0.24", default-features = false } fs_extra = "1" -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "d97ea65"} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c"} [dev-dependencies] which = "4" diff --git a/rascaline-torch/CMakeLists.txt b/rascaline-torch/CMakeLists.txt index ad23ae3cd..b14fb7210 100644 --- a/rascaline-torch/CMakeLists.txt +++ b/rascaline-torch/CMakeLists.txt @@ -58,7 +58,7 @@ find_package(Torch 1.11 REQUIRED) # ============================================================================ # # Setup metatensor_torch -set(METATENSOR_GIT_VERSION "d97ea65") +set(METATENSOR_GIT_VERSION "2248a3c") set(REQUIRED_METATENSOR_TORCH_VERSION "0.1") if (RASCALINE_TORCH_FETCH_METATENSOR_TORCH) message(STATUS "Fetching metatensor_torch @ ${METATENSOR_GIT_VERSION} from github") @@ -67,7 +67,7 @@ if (RASCALINE_TORCH_FETCH_METATENSOR_TORCH) FetchContent_Declare( metatensor_torch URL https://github.com/lab-cosmo/metatensor/archive/${METATENSOR_GIT_VERSION}.zip - URL_HASH MD5=6a6899779591ae15861bb3547c7c354b + URL_HASH MD5=50e70a2e74246a985e1520260a74205c SOURCE_SUBDIR metatensor-torch VERBOSE ) diff --git a/rascaline/Cargo.toml b/rascaline/Cargo.toml index fecf212a9..885007351 100644 --- a/rascaline/Cargo.toml +++ b/rascaline/Cargo.toml @@ -36,7 +36,7 @@ name = "soap-power-spectrum" harness = false [dependencies] -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "d97ea65", features = ["rayon"]} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c", features = ["rayon"]} ndarray = {version = "0.15", features = ["approx-0_5", "rayon", "serde"]} num-traits = "0.2" diff --git a/tox.ini b/tox.ini index 29e8a69ad..0c1a661e3 100644 --- a/tox.ini +++ b/tox.ini @@ -19,10 +19,10 @@ lint-folders = "{toxinidir}/python" "{toxinidir}/setup.py" # we need to manually install dependencies for rascaline, since tox will install # the fresh wheel with `--no-deps` after building it. metatensor-core-requirement = - metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/d97ea65.zip\#subdirectory=python/metatensor-core + metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip\#subdirectory=python/metatensor-core metatensor-torch-requirement = - metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/d97ea65.zip\#subdirectory=python/metatensor-torch + metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip\#subdirectory=python/metatensor-torch build-single-wheel = --no-deps --no-build-isolation --check-build-dependencies