Skip to content

Commit

Permalink
Rename to metatensor-models (#15)
Browse files Browse the repository at this point in the history
* Rename package to `metatensor-models`

* Rename module to `metatensor.models`
  • Loading branch information
frostedoyster authored Dec 6, 2023
1 parent 9c632bb commit 99ca38b
Show file tree
Hide file tree
Showing 36 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("..", ".."))
Expand All @@ -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 ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/src/dev-docs/utils/dataset.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Dataset
#######

.. automodule:: metatensor_models.utils.data.dataset
.. automodule:: metatensor.models.utils.data.dataset
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/src/dev-docs/utils/readers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/src/dev-docs/utils/readers/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions docs/src/dev-docs/utils/readers/target.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/src/models/soap-bpnn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "metatensor_models"
name = "metatensor-models"
dynamic = ["version"]
requires-python = ">=3.7"

Expand Down Expand Up @@ -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"

### ======================================================================== ###

Expand All @@ -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]
Expand All @@ -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"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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])
2 changes: 1 addition & 1 deletion tests/data.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
4 changes: 2 additions & 2 deletions tests/init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import metatensor_models
import metatensor.models


def test_version_exists():
metatensor_models.__version__
metatensor.models.__version__
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99ca38b

Please sign in to comment.