diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a07eb9e..1f6f3a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,10 @@ concurrency: jobs: - test-mc-optimade-package: - name: Test the `mc_optimade` package + tests: + name: Test the `optimake` package runs-on: ubuntu-latest - defaults: - run: - working-directory: src/mc_optimade - steps: - uses: actions/checkout@v3 @@ -43,7 +39,7 @@ jobs: pip install -e .[tests,dev] - name: Run tests - run: pytest -vv --cov-report=xml --cov-report=term + run: pytest -vv --cov-report=xml --cov-report=term ./tests - name: Upload coverage uses: codecov/codecov-action@v3 diff --git a/src/mc_optimade/.pre-commit-config.yaml b/.pre-commit-config.yaml similarity index 100% rename from src/mc_optimade/.pre-commit-config.yaml rename to .pre-commit-config.yaml diff --git a/README.md b/README.md index 0a3031e..2e146e6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Code for making [OPTIMADE APIs](https://optimade.org) from various formats of st This repository contains the following Python packages that work towards this aim: -- `src/mc_optimade`: defines a config file format for annotating archives and registered the desired OPTIMADE entries, and a workflow for ingesting them and converting into OPTIMADE types using pre-existing parsers (e.g., ASE for structures). The archive is converted into an intermediate [OPTIMADE JSON Lines](https://github.com/Materials-Consortia/OPTIMADE/issues/471) format that can be ingested into a database and used to serve a full OPTIMADE API. +- `src/optimake: defines a config file format for annotating archives and registered the desired OPTIMADE entries, and a workflow for ingesting them and converting into OPTIMADE types using pre-existing parsers (e.g., ASE for structures). The archive is converted into an intermediate [OPTIMADE JSON Lines](https://github.com/Materials-Consortia/OPTIMADE/issues/471) format that can be ingested into a database and used to serve a full OPTIMADE API. - `src/optimade_launch`: provides a platform for launching an OPTIMADE API server from such a JSON lines file. It does so using the [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/) @@ -33,7 +33,7 @@ entries: Run `optimake .` in the folder containing `structures.zip` and `optimade.yaml` to generate the jsonl file. -See `src/mc_optimade/examples` for other supported formats and corresponding `optimade.yaml` config files. +See `./examples` for other supported formats and corresponding `optimade.yaml` config files. ## Relevant links diff --git a/src/mc_optimade/examples/bzipped_pymatgen/.testing/first_entry.json b/examples/bzipped_pymatgen/.testing/first_entry.json similarity index 100% rename from src/mc_optimade/examples/bzipped_pymatgen/.testing/first_entry.json rename to examples/bzipped_pymatgen/.testing/first_entry.json diff --git a/src/mc_optimade/examples/bzipped_pymatgen/optimade.yaml b/examples/bzipped_pymatgen/optimade.yaml similarity index 100% rename from src/mc_optimade/examples/bzipped_pymatgen/optimade.yaml rename to examples/bzipped_pymatgen/optimade.yaml diff --git a/src/mc_optimade/examples/bzipped_pymatgen/part_1.json.bz2 b/examples/bzipped_pymatgen/part_1.json.bz2 similarity index 100% rename from src/mc_optimade/examples/bzipped_pymatgen/part_1.json.bz2 rename to examples/bzipped_pymatgen/part_1.json.bz2 diff --git a/src/mc_optimade/examples/direct_from_jsonl/.testing/first_entry.json b/examples/direct_from_jsonl/.testing/first_entry.json similarity index 100% rename from src/mc_optimade/examples/direct_from_jsonl/.testing/first_entry.json rename to examples/direct_from_jsonl/.testing/first_entry.json diff --git a/src/mc_optimade/examples/direct_from_jsonl/example.jsonl b/examples/direct_from_jsonl/example.jsonl similarity index 100% rename from src/mc_optimade/examples/direct_from_jsonl/example.jsonl rename to examples/direct_from_jsonl/example.jsonl diff --git a/src/mc_optimade/examples/direct_from_jsonl/optimade.yaml b/examples/direct_from_jsonl/optimade.yaml similarity index 100% rename from src/mc_optimade/examples/direct_from_jsonl/optimade.yaml rename to examples/direct_from_jsonl/optimade.yaml diff --git a/src/mc_optimade/examples/folder_of_cifs/.testing/first_entry.json b/examples/folder_of_cifs/.testing/first_entry.json similarity index 100% rename from src/mc_optimade/examples/folder_of_cifs/.testing/first_entry.json rename to examples/folder_of_cifs/.testing/first_entry.json diff --git a/src/mc_optimade/examples/folder_of_cifs/README.md b/examples/folder_of_cifs/README.md similarity index 100% rename from src/mc_optimade/examples/folder_of_cifs/README.md rename to examples/folder_of_cifs/README.md diff --git a/src/mc_optimade/examples/folder_of_cifs/data.tar.gz b/examples/folder_of_cifs/data.tar.gz similarity index 100% rename from src/mc_optimade/examples/folder_of_cifs/data.tar.gz rename to examples/folder_of_cifs/data.tar.gz diff --git a/src/mc_optimade/examples/folder_of_cifs/optimade.yaml b/examples/folder_of_cifs/optimade.yaml similarity index 100% rename from src/mc_optimade/examples/folder_of_cifs/optimade.yaml rename to examples/folder_of_cifs/optimade.yaml diff --git a/src/mc_optimade/examples/folder_of_cifs/structures.zip b/examples/folder_of_cifs/structures.zip similarity index 100% rename from src/mc_optimade/examples/folder_of_cifs/structures.zip rename to examples/folder_of_cifs/structures.zip diff --git a/src/mc_optimade/examples/xyz_files_no_compression/.testing/first_entry.json b/examples/xyz_files_no_compression/.testing/first_entry.json similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/.testing/first_entry.json rename to examples/xyz_files_no_compression/.testing/first_entry.json diff --git a/src/mc_optimade/examples/xyz_files_no_compression/C_1.xyz b/examples/xyz_files_no_compression/C_1.xyz similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/C_1.xyz rename to examples/xyz_files_no_compression/C_1.xyz diff --git a/src/mc_optimade/examples/xyz_files_no_compression/H_1.xyz b/examples/xyz_files_no_compression/H_1.xyz similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/H_1.xyz rename to examples/xyz_files_no_compression/H_1.xyz diff --git a/src/mc_optimade/examples/xyz_files_no_compression/H_2.xyz b/examples/xyz_files_no_compression/H_2.xyz similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/H_2.xyz rename to examples/xyz_files_no_compression/H_2.xyz diff --git a/src/mc_optimade/examples/xyz_files_no_compression/data.csv b/examples/xyz_files_no_compression/data.csv similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/data.csv rename to examples/xyz_files_no_compression/data.csv diff --git a/src/mc_optimade/examples/xyz_files_no_compression/optimade.yaml b/examples/xyz_files_no_compression/optimade.yaml similarity index 100% rename from src/mc_optimade/examples/xyz_files_no_compression/optimade.yaml rename to examples/xyz_files_no_compression/optimade.yaml diff --git a/src/mc_optimade/pyproject.toml b/pyproject.toml similarity index 90% rename from src/mc_optimade/pyproject.toml rename to pyproject.toml index 424dcef..85f4f60 100644 --- a/src/mc_optimade/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "mc_optimade" +name = "optimake" version = "0.1" requires-python = ">=3.10" @@ -34,8 +34,8 @@ ignore_missing_imports = true follow_imports = "skip" [tool.isort] -known_first_party = "mc_optimade" +known_first_party = "optimake" profile = "black" [project.scripts] -optimake = "mc_optimade.cli:main" +optimake = "optimake.cli:main" diff --git a/src/mc_optimade/mc_optimade/__init__.py b/src/mc_optimade/mc_optimade/__init__.py deleted file mode 100644 index 249ce64..0000000 --- a/src/mc_optimade/mc_optimade/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from mc_optimade.config import Config -from mc_optimade.convert import convert_archive - -__all__ = ("Config", "convert_archive") diff --git a/src/optimake/__init__.py b/src/optimake/__init__.py new file mode 100644 index 0000000..9e85e99 --- /dev/null +++ b/src/optimake/__init__.py @@ -0,0 +1,4 @@ +from optimake.config import Config +from optimake.convert import convert_archive + +__all__ = ("Config", "convert_archive") diff --git a/src/mc_optimade/mc_optimade/archive/__init__.py b/src/optimake/archive/__init__.py similarity index 100% rename from src/mc_optimade/mc_optimade/archive/__init__.py rename to src/optimake/archive/__init__.py diff --git a/src/mc_optimade/mc_optimade/archive/archive_record.py b/src/optimake/archive/archive_record.py similarity index 99% rename from src/mc_optimade/mc_optimade/archive/archive_record.py rename to src/optimake/archive/archive_record.py index 8962fa4..e2ef971 100644 --- a/src/mc_optimade/mc_optimade/archive/archive_record.py +++ b/src/optimake/archive/archive_record.py @@ -4,7 +4,7 @@ import requests -from mc_optimade.config import Config +from optimake.config import Config DEFAULT_ARCHIVE_URL = "https://archive.materialscloud.org" diff --git a/src/mc_optimade/mc_optimade/archive/cli.py b/src/optimake/archive/cli.py similarity index 71% rename from src/mc_optimade/mc_optimade/archive/cli.py rename to src/optimake/archive/cli.py index f1b8975..ab1d9f4 100644 --- a/src/mc_optimade/mc_optimade/archive/cli.py +++ b/src/optimake/archive/cli.py @@ -1,5 +1,5 @@ import click -from scan_records import scan_records +from .scan_records import scan_records @click.group() diff --git a/src/mc_optimade/mc_optimade/archive/scan_records.py b/src/optimake/archive/scan_records.py similarity index 90% rename from src/mc_optimade/mc_optimade/archive/scan_records.py rename to src/optimake/archive/scan_records.py index c370f8b..ef68b19 100644 --- a/src/mc_optimade/mc_optimade/archive/scan_records.py +++ b/src/optimake/archive/scan_records.py @@ -1,7 +1,7 @@ import tqdm -from mc_optimade.archive.archive_record import ArchiveRecord -from mc_optimade.archive.utils import get_all_records, get_parsed_records +from optimake.archive.archive_record import ArchiveRecord +from optimake.archive.utils import get_all_records, get_parsed_records DEFAULT_ARCHIVE_URL = "https://archive.materialscloud.org/" diff --git a/src/mc_optimade/mc_optimade/archive/utils.py b/src/optimake/archive/utils.py similarity index 100% rename from src/mc_optimade/mc_optimade/archive/utils.py rename to src/optimake/archive/utils.py diff --git a/src/mc_optimade/mc_optimade/cli.py b/src/optimake/cli.py similarity index 93% rename from src/mc_optimade/mc_optimade/cli.py rename to src/optimake/cli.py index 1022840..cbfaeb3 100644 --- a/src/mc_optimade/mc_optimade/cli.py +++ b/src/optimake/cli.py @@ -1,6 +1,6 @@ import argparse from pathlib import Path -from mc_optimade.convert import convert_archive +from optimake.convert import convert_archive def main(): parser = argparse.ArgumentParser( diff --git a/src/mc_optimade/mc_optimade/config.py b/src/optimake/config.py similarity index 100% rename from src/mc_optimade/mc_optimade/config.py rename to src/optimake/config.py diff --git a/src/mc_optimade/mc_optimade/convert.py b/src/optimake/convert.py similarity index 99% rename from src/mc_optimade/mc_optimade/convert.py rename to src/optimake/convert.py index 2f605fa..026dfd1 100644 --- a/src/mc_optimade/mc_optimade/convert.py +++ b/src/optimake/convert.py @@ -17,7 +17,7 @@ from .config import Config, EntryConfig, JSONLConfig, ParsedFiles, PropertyDefinition from .parsers import ENTRY_PARSERS, OPTIMADE_CONVERTERS, PROPERTY_PARSERS, TYPE_MAP -PROVIDER_PREFIX = os.environ.get("MC_OPTIMADE_PROVIDER_PREFIX", "mcloudarchive") +PROVIDER_PREFIX = os.environ.get("optimake_PROVIDER_PREFIX", "mcloudarchive") def _construct_entry_type_info( diff --git a/src/mc_optimade/mc_optimade/parsers.py b/src/optimake/parsers.py similarity index 98% rename from src/mc_optimade/mc_optimade/parsers.py rename to src/optimake/parsers.py index c3a6709..4ed18fd 100644 --- a/src/mc_optimade/mc_optimade/parsers.py +++ b/src/optimake/parsers.py @@ -10,7 +10,7 @@ from optimade.models import EntryResource from pymatgen.entries.computed_entries import ComputedStructureEntry -from mc_optimade.config import PropertyDefinition +from optimake.config import PropertyDefinition def pybtex_to_optimade(bib_entry: Any, properties=None) -> EntryResource: diff --git a/src/mc_optimade/tests/test_archive.py b/tests/test_archive.py similarity index 81% rename from src/mc_optimade/tests/test_archive.py rename to tests/test_archive.py index 1655423..89fb04f 100644 --- a/src/mc_optimade/tests/test_archive.py +++ b/tests/test_archive.py @@ -1,6 +1,6 @@ import traceback -from mc_optimade.config import UnsupportedConfigVersion +from optimake.config import UnsupportedConfigVersion archive_url = "https://staging-archive.materialscloud.org/" test_record_id = 1408 @@ -8,7 +8,7 @@ def test_archive_record_metadata(): """Test ArchiveRecord to read metadata.""" - from mc_optimade.archive.archive_record import ArchiveRecord + from optimake.archive.archive_record import ArchiveRecord try: record = ArchiveRecord(test_record_id, archive_url=archive_url) @@ -22,7 +22,7 @@ def test_archive_record_process(): """Test ArchiveRecord to download files.""" import os - from mc_optimade.archive.archive_record import ArchiveRecord + from optimake.archive.archive_record import ArchiveRecord try: record = ArchiveRecord( diff --git a/src/mc_optimade/tests/test_convert.py b/tests/test_convert.py similarity index 98% rename from src/mc_optimade/tests/test_convert.py rename to tests/test_convert.py index 3ddec23..0da1cb4 100644 --- a/src/mc_optimade/tests/test_convert.py +++ b/tests/test_convert.py @@ -5,7 +5,7 @@ import pytest from optimade.models import EntryInfoResource -from mc_optimade.convert import convert_archive +from optimake.convert import convert_archive EXAMPLE_ARCHIVES = (Path(__file__).parent.parent / "examples").glob("*") diff --git a/src/mc_optimade/tests/test_yaml.py b/tests/test_yaml.py similarity index 86% rename from src/mc_optimade/tests/test_yaml.py rename to tests/test_yaml.py index 763e048..08c4828 100644 --- a/src/mc_optimade/tests/test_yaml.py +++ b/tests/test_yaml.py @@ -2,7 +2,7 @@ import pytest -from mc_optimade.config import Config +from optimake.config import Config EXAMPLE_YAMLS = (Path(__file__).parent.parent / "examples").glob("*/optimade.yaml")