Skip to content

Commit

Permalink
Restructure repository around 'optimake' package (#46)
Browse files Browse the repository at this point in the history
* Restructure repository around 'optimake' package

* Update CI working directory

* Update CI test invocation
  • Loading branch information
ml-evs authored Jan 16, 2024
1 parent b802ff4 commit 94073ac
Show file tree
Hide file tree
Showing 35 changed files with 24 additions and 28 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand All @@ -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
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/mc_optimade/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "mc_optimade"
name = "optimake"
version = "0.1"
requires-python = ">=3.10"

Expand Down Expand Up @@ -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"
4 changes: 0 additions & 4 deletions src/mc_optimade/mc_optimade/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions src/optimake/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from optimake.config import Config
from optimake.convert import convert_archive

__all__ = ("Config", "convert_archive")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import requests

from mc_optimade.config import Config
from optimake.config import Config

DEFAULT_ARCHIVE_URL = "https://archive.materialscloud.org"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import click
from scan_records import scan_records
from .scan_records import scan_records


@click.group()
Expand Down
Original file line number Diff line number Diff line change
@@ -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/"

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/mc_optimade/mc_optimade/cli.py → src/optimake/cli.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import traceback

from mc_optimade.config import UnsupportedConfigVersion
from optimake.config import UnsupportedConfigVersion

archive_url = "https://staging-archive.materialscloud.org/"
test_record_id = 1408


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)
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("*")

Expand Down
2 changes: 1 addition & 1 deletion src/mc_optimade/tests/test_yaml.py → tests/test_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 94073ac

Please sign in to comment.