From 99ca38b561624cd0c0b51a495fdaeac5eff5fdb6 Mon Sep 17 00:00:00 2001 From: Filippo Bigi <98903385+frostedoyster@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:42:22 +0100 Subject: [PATCH] Rename to `metatensor-models` (#15) * Rename package to `metatensor-models` * Rename module to `metatensor.models` --- docs/src/conf.py | 4 ++-- docs/src/dev-docs/utils/dataset.rst | 2 +- docs/src/dev-docs/utils/readers/index.rst | 2 +- docs/src/dev-docs/utils/readers/structure.rst | 4 ++-- docs/src/dev-docs/utils/readers/target.rst | 4 ++-- docs/src/models/soap-bpnn.rst | 2 +- pyproject.toml | 10 +++++----- .../models}/__init__.py | 0 .../models}/__main__.py | 2 +- .../models}/scripts/__init__.py | 0 .../models}/scripts/evaluate.py | 0 .../models}/scripts/export.py | 0 .../models}/scripts/train.py | 0 .../models}/soap_bpnn/__init__.py | 0 .../models}/soap_bpnn/default.yml | 0 .../models}/soap_bpnn/model.py | 0 .../models}/soap_bpnn/tests/data/qm9_reduced_100.xyz | 0 .../models}/soap_bpnn/tests/data/readme.txt | 0 .../models}/soap_bpnn/tests/test_functionality.py | 2 +- .../models}/soap_bpnn/tests/test_invariance.py | 2 +- .../models}/soap_bpnn/tests/test_regression.py | 6 +++--- .../models}/soap_bpnn/tests/test_torchscript.py | 2 +- .../models}/soap_bpnn/train.py | 0 .../models}/utils/__init__.py | 0 .../models}/utils/composition.py | 0 .../models}/utils/data/__init__.py | 0 .../models}/utils/data/dataset.py | 0 .../models}/utils/data/readers/__init__.py | 0 .../models}/utils/data/readers/structures/__init__.py | 0 .../models}/utils/data/readers/structures/ase.py | 0 .../models}/utils/data/readers/targets/__init__.py | 0 .../models}/utils/data/readers/targets/ase.py | 0 tests/cli.py | 10 +++++----- tests/data.py | 2 +- tests/init.py | 4 ++-- tox.ini | 2 +- 36 files changed, 30 insertions(+), 30 deletions(-) rename src/{metatensor_models => metatensor/models}/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/__main__.py (97%) rename src/{metatensor_models => metatensor/models}/scripts/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/scripts/evaluate.py (100%) rename src/{metatensor_models => metatensor/models}/scripts/export.py (100%) rename src/{metatensor_models => metatensor/models}/scripts/train.py (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/default.yml (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/model.py (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/data/qm9_reduced_100.xyz (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/data/readme.txt (100%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/test_functionality.py (92%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/test_invariance.py (94%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/test_regression.py (92%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/tests/test_torchscript.py (89%) rename src/{metatensor_models => metatensor/models}/soap_bpnn/train.py (100%) rename src/{metatensor_models => metatensor/models}/utils/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/utils/composition.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/dataset.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/readers/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/readers/structures/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/readers/structures/ase.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/readers/targets/__init__.py (100%) rename src/{metatensor_models => metatensor/models}/utils/data/readers/targets/ase.py (100%) diff --git a/docs/src/conf.py b/docs/src/conf.py index f4958dd77..ccf5aeef3 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -4,7 +4,7 @@ import tomli # Replace by tomllib from std library once docs are build with Python 3.11 -import metatensor_models +import metatensor.models ROOT = os.path.abspath(os.path.join("..", "..")) @@ -24,7 +24,7 @@ copyright = f"{datetime.now().date().year}, {author}" # The full version, including alpha/beta/rc tags -release = metatensor_models.__version__ +release = metatensor.models.__version__ # -- General configuration --------------------------------------------------- diff --git a/docs/src/dev-docs/utils/dataset.rst b/docs/src/dev-docs/utils/dataset.rst index f1642129c..c086d3e84 100644 --- a/docs/src/dev-docs/utils/dataset.rst +++ b/docs/src/dev-docs/utils/dataset.rst @@ -1,7 +1,7 @@ Dataset ####### -.. automodule:: metatensor_models.utils.data.dataset +.. automodule:: metatensor.models.utils.data.dataset :members: :undoc-members: :show-inheritance: diff --git a/docs/src/dev-docs/utils/readers/index.rst b/docs/src/dev-docs/utils/readers/index.rst index 19ee22c83..c221ecfd5 100644 --- a/docs/src/dev-docs/utils/readers/index.rst +++ b/docs/src/dev-docs/utils/readers/index.rst @@ -4,7 +4,7 @@ Structure and Target data Readers The main entry point for reading structure and target information are the two reader functions -.. automodule:: metatensor_models.utils.data.readers +.. automodule:: metatensor.models.utils.data.readers :members: Based on the provided filename they chose which child reader they use. For details on diff --git a/docs/src/dev-docs/utils/readers/structure.rst b/docs/src/dev-docs/utils/readers/structure.rst index fca290ae4..4b76fecdb 100644 --- a/docs/src/dev-docs/utils/readers/structure.rst +++ b/docs/src/dev-docs/utils/readers/structure.rst @@ -5,9 +5,9 @@ Parsers for obtaining information from structures. All readers return a :py:clas of :py:class:`rascaline.torch.system.System`. The mapping which reader is used for which file type is stored in -.. autodata:: metatensor_models.utils.data.readers.structures.STRUCTURE_READERS +.. autodata:: metatensor.models.utils.data.readers.structures.STRUCTURE_READERS Implemented Readers ------------------- -.. autofunction:: metatensor_models.utils.data.readers.structures.read_ase +.. autofunction:: metatensor.models.utils.data.readers.structures.read_ase diff --git a/docs/src/dev-docs/utils/readers/target.rst b/docs/src/dev-docs/utils/readers/target.rst index 4b2401427..4c6382073 100644 --- a/docs/src/dev-docs/utils/readers/target.rst +++ b/docs/src/dev-docs/utils/readers/target.rst @@ -5,9 +5,9 @@ Parsers for obtaining information from structures. All readers return a of :py:class:`metatensor.torch.TensorMap`. The mapping which reader is used for which file type is stored in -.. autodata:: metatensor_models.utils.data.readers.targets.TARGET_READERS +.. autodata:: metatensor.models.utils.data.readers.targets.TARGET_READERS Implemented Readers ------------------- -.. autofunction:: metatensor_models.utils.data.readers.targets.read_ase +.. autofunction:: metatensor.models.utils.data.readers.targets.read_ase diff --git a/docs/src/models/soap-bpnn.rst b/docs/src/models/soap-bpnn.rst index 9b75acbdf..1438db587 100644 --- a/docs/src/models/soap-bpnn.rst +++ b/docs/src/models/soap-bpnn.rst @@ -22,7 +22,7 @@ Hyperparameters The hyperparameters (and relative default values) for the SOAP-BPNN model are: -.. literalinclude:: ../../../src/metatensor_models/soap_bpnn/default.yml +.. literalinclude:: ../../../src/metatensor/models/soap_bpnn/default.yml :language: yaml Any of these hyperparameters can be overridden in the training configuration file. diff --git a/pyproject.toml b/pyproject.toml index be063013c..dd2ebee8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "metatensor_models" +name = "metatensor-models" dynamic = ["version"] requires-python = ">=3.7" @@ -43,7 +43,7 @@ repository = "https://github.com/lab-cosmo/metatensor-models" # changelog = "TODO" [project.scripts] -metatensor_models = "metatensor_models.__main__:main" +metatensor-models = "metatensor.models.__main__:main" ### ======================================================================== ### @@ -61,11 +61,11 @@ soap-bpnn = [] where = ["src"] [tool.setuptools.dynamic] -version = {attr = "metatensor_models.__version__"} +version = {attr = "metatensor.models.__version__"} [tool.coverage.report] include = [ - "src/metatensor_models/*" + "src/metatensor/models/*" ] [tool.coverage.xml] @@ -82,4 +82,4 @@ line_length = 88 indent = 4 include_trailing_comma = true lines_after_imports = 2 -known_first_party = "metatensor_models" +known_first_party = "metatensor-models" diff --git a/src/metatensor_models/__init__.py b/src/metatensor/models/__init__.py similarity index 100% rename from src/metatensor_models/__init__.py rename to src/metatensor/models/__init__.py diff --git a/src/metatensor_models/__main__.py b/src/metatensor/models/__main__.py similarity index 97% rename from src/metatensor_models/__main__.py rename to src/metatensor/models/__main__.py index 7263902ae..7a41066c9 100644 --- a/src/metatensor_models/__main__.py +++ b/src/metatensor/models/__main__.py @@ -15,7 +15,7 @@ def main(): ap.add_argument( "--version", action="version", - version=f"metatensor_models {__version__}", + version=f"metatensor-models {__version__}", ) ap.add_argument( diff --git a/src/metatensor_models/scripts/__init__.py b/src/metatensor/models/scripts/__init__.py similarity index 100% rename from src/metatensor_models/scripts/__init__.py rename to src/metatensor/models/scripts/__init__.py diff --git a/src/metatensor_models/scripts/evaluate.py b/src/metatensor/models/scripts/evaluate.py similarity index 100% rename from src/metatensor_models/scripts/evaluate.py rename to src/metatensor/models/scripts/evaluate.py diff --git a/src/metatensor_models/scripts/export.py b/src/metatensor/models/scripts/export.py similarity index 100% rename from src/metatensor_models/scripts/export.py rename to src/metatensor/models/scripts/export.py diff --git a/src/metatensor_models/scripts/train.py b/src/metatensor/models/scripts/train.py similarity index 100% rename from src/metatensor_models/scripts/train.py rename to src/metatensor/models/scripts/train.py diff --git a/src/metatensor_models/soap_bpnn/__init__.py b/src/metatensor/models/soap_bpnn/__init__.py similarity index 100% rename from src/metatensor_models/soap_bpnn/__init__.py rename to src/metatensor/models/soap_bpnn/__init__.py diff --git a/src/metatensor_models/soap_bpnn/default.yml b/src/metatensor/models/soap_bpnn/default.yml similarity index 100% rename from src/metatensor_models/soap_bpnn/default.yml rename to src/metatensor/models/soap_bpnn/default.yml diff --git a/src/metatensor_models/soap_bpnn/model.py b/src/metatensor/models/soap_bpnn/model.py similarity index 100% rename from src/metatensor_models/soap_bpnn/model.py rename to src/metatensor/models/soap_bpnn/model.py diff --git a/src/metatensor_models/soap_bpnn/tests/data/qm9_reduced_100.xyz b/src/metatensor/models/soap_bpnn/tests/data/qm9_reduced_100.xyz similarity index 100% rename from src/metatensor_models/soap_bpnn/tests/data/qm9_reduced_100.xyz rename to src/metatensor/models/soap_bpnn/tests/data/qm9_reduced_100.xyz diff --git a/src/metatensor_models/soap_bpnn/tests/data/readme.txt b/src/metatensor/models/soap_bpnn/tests/data/readme.txt similarity index 100% rename from src/metatensor_models/soap_bpnn/tests/data/readme.txt rename to src/metatensor/models/soap_bpnn/tests/data/readme.txt diff --git a/src/metatensor_models/soap_bpnn/tests/test_functionality.py b/src/metatensor/models/soap_bpnn/tests/test_functionality.py similarity index 92% rename from src/metatensor_models/soap_bpnn/tests/test_functionality.py rename to src/metatensor/models/soap_bpnn/tests/test_functionality.py index 45a5da396..6666385b7 100644 --- a/src/metatensor_models/soap_bpnn/tests/test_functionality.py +++ b/src/metatensor/models/soap_bpnn/tests/test_functionality.py @@ -5,7 +5,7 @@ import torch import yaml -from metatensor_models.soap_bpnn import SoapBPNN +from metatensor.models.soap_bpnn import SoapBPNN path = os.path.dirname(__file__) diff --git a/src/metatensor_models/soap_bpnn/tests/test_invariance.py b/src/metatensor/models/soap_bpnn/tests/test_invariance.py similarity index 94% rename from src/metatensor_models/soap_bpnn/tests/test_invariance.py rename to src/metatensor/models/soap_bpnn/tests/test_invariance.py index 06bccc36b..28df0a735 100644 --- a/src/metatensor_models/soap_bpnn/tests/test_invariance.py +++ b/src/metatensor/models/soap_bpnn/tests/test_invariance.py @@ -6,7 +6,7 @@ import torch import yaml -from metatensor_models.soap_bpnn import SoapBPNN +from metatensor.models.soap_bpnn import SoapBPNN path = os.path.dirname(__file__) diff --git a/src/metatensor_models/soap_bpnn/tests/test_regression.py b/src/metatensor/models/soap_bpnn/tests/test_regression.py similarity index 92% rename from src/metatensor_models/soap_bpnn/tests/test_regression.py rename to src/metatensor/models/soap_bpnn/tests/test_regression.py index 4770f644e..df293a2c5 100644 --- a/src/metatensor_models/soap_bpnn/tests/test_regression.py +++ b/src/metatensor/models/soap_bpnn/tests/test_regression.py @@ -5,9 +5,9 @@ import torch import yaml -from metatensor_models.soap_bpnn import SoapBPNN, train -from metatensor_models.utils.data import Dataset -from metatensor_models.utils.data.readers import read_structures, read_targets +from metatensor.models.soap_bpnn import SoapBPNN, train +from metatensor.models.utils.data import Dataset +from metatensor.models.utils.data.readers import read_structures, read_targets torch.manual_seed(0) diff --git a/src/metatensor_models/soap_bpnn/tests/test_torchscript.py b/src/metatensor/models/soap_bpnn/tests/test_torchscript.py similarity index 89% rename from src/metatensor_models/soap_bpnn/tests/test_torchscript.py rename to src/metatensor/models/soap_bpnn/tests/test_torchscript.py index 41739a54a..5a469ee0b 100644 --- a/src/metatensor_models/soap_bpnn/tests/test_torchscript.py +++ b/src/metatensor/models/soap_bpnn/tests/test_torchscript.py @@ -3,7 +3,7 @@ import torch import yaml -from metatensor_models.soap_bpnn import SoapBPNN +from metatensor.models.soap_bpnn import SoapBPNN path = os.path.dirname(__file__) diff --git a/src/metatensor_models/soap_bpnn/train.py b/src/metatensor/models/soap_bpnn/train.py similarity index 100% rename from src/metatensor_models/soap_bpnn/train.py rename to src/metatensor/models/soap_bpnn/train.py diff --git a/src/metatensor_models/utils/__init__.py b/src/metatensor/models/utils/__init__.py similarity index 100% rename from src/metatensor_models/utils/__init__.py rename to src/metatensor/models/utils/__init__.py diff --git a/src/metatensor_models/utils/composition.py b/src/metatensor/models/utils/composition.py similarity index 100% rename from src/metatensor_models/utils/composition.py rename to src/metatensor/models/utils/composition.py diff --git a/src/metatensor_models/utils/data/__init__.py b/src/metatensor/models/utils/data/__init__.py similarity index 100% rename from src/metatensor_models/utils/data/__init__.py rename to src/metatensor/models/utils/data/__init__.py diff --git a/src/metatensor_models/utils/data/dataset.py b/src/metatensor/models/utils/data/dataset.py similarity index 100% rename from src/metatensor_models/utils/data/dataset.py rename to src/metatensor/models/utils/data/dataset.py diff --git a/src/metatensor_models/utils/data/readers/__init__.py b/src/metatensor/models/utils/data/readers/__init__.py similarity index 100% rename from src/metatensor_models/utils/data/readers/__init__.py rename to src/metatensor/models/utils/data/readers/__init__.py diff --git a/src/metatensor_models/utils/data/readers/structures/__init__.py b/src/metatensor/models/utils/data/readers/structures/__init__.py similarity index 100% rename from src/metatensor_models/utils/data/readers/structures/__init__.py rename to src/metatensor/models/utils/data/readers/structures/__init__.py diff --git a/src/metatensor_models/utils/data/readers/structures/ase.py b/src/metatensor/models/utils/data/readers/structures/ase.py similarity index 100% rename from src/metatensor_models/utils/data/readers/structures/ase.py rename to src/metatensor/models/utils/data/readers/structures/ase.py diff --git a/src/metatensor_models/utils/data/readers/targets/__init__.py b/src/metatensor/models/utils/data/readers/targets/__init__.py similarity index 100% rename from src/metatensor_models/utils/data/readers/targets/__init__.py rename to src/metatensor/models/utils/data/readers/targets/__init__.py diff --git a/src/metatensor_models/utils/data/readers/targets/ase.py b/src/metatensor/models/utils/data/readers/targets/ase.py similarity index 100% rename from src/metatensor_models/utils/data/readers/targets/ase.py rename to src/metatensor/models/utils/data/readers/targets/ase.py diff --git a/tests/cli.py b/tests/cli.py index 95dd4da8c..859df1241 100644 --- a/tests/cli.py +++ b/tests/cli.py @@ -3,7 +3,7 @@ import pytest -from metatensor_models.scripts import __all__ as available_scripts +from metatensor.models.scripts import __all__ as available_scripts class Test_parse_args(object): @@ -12,19 +12,19 @@ class Test_parse_args(object): def test_required_args(self): """Test required arguments.""" with pytest.raises(subprocess.CalledProcessError): - subprocess.check_call(["metatensor_models"]) + subprocess.check_call(["metatensor-models"]) def test_wrong_module(self): """Test wrong module.""" with pytest.raises(subprocess.CalledProcessError): - subprocess.check_call(["metatensor_models", "foo"]) + subprocess.check_call(["metatensor-models", "foo"]) @pytest.mark.parametrize("module", tuple(available_scripts)) def test_available_modules(self, module): """Test available modules.""" - subprocess.check_call(["metatensor_models", module, "--help"]) + subprocess.check_call(["metatensor-models", module, "--help"]) @pytest.mark.parametrize("args", ("version", "help")) def test_extra_options(self, args): """Test extra options.""" - subprocess.check_call(["metatensor_models", "--" + args]) + subprocess.check_call(["metatensor-models", "--" + args]) diff --git a/tests/data.py b/tests/data.py index 63aacc9e9..00d5ec542 100644 --- a/tests/data.py +++ b/tests/data.py @@ -1,7 +1,7 @@ import os import torch -from metatensor_models.utils.data import Dataset, collate_fn, read_structures, read_targets +from metatensor.models.utils.data import Dataset, collate_fn, read_structures, read_targets def test_dataset(): diff --git a/tests/init.py b/tests/init.py index e4a2c3cc2..c577ccaca 100644 --- a/tests/init.py +++ b/tests/init.py @@ -1,5 +1,5 @@ -import metatensor_models +import metatensor.models def test_version_exists(): - metatensor_models.__version__ + metatensor.models.__version__ diff --git a/tox.ini b/tox.ini index e2c96f475..f1605a096 100644 --- a/tox.ini +++ b/tox.ini @@ -73,7 +73,7 @@ allowlist_externals = cd commands = - pytest --import-mode=append {posargs} src/metatensor_models/soap_bpnn/tests/ + pytest --import-mode=append {posargs} src/metatensor/models/soap_bpnn/tests/ [testenv:docs] # this environement builds the documentation with sphinx