Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename python package to optimade-maker #63

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 31 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- main
- main

env:
PYTEST_ADDOPTS: "--color=yes"
Expand All @@ -16,38 +16,37 @@ concurrency:
cancel-in-progress: true

jobs:

tests:
name: Test the `optimake` package
name: Test the `optimade-maker` package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: |
pyproject.toml

- name: Install latest compatible versions of immediate dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -e .[tests,dev]

- name: Run linters
run: |
pre-commit run --all-files

- name: Run tests
run: pytest -vv --cov-report=xml --cov-report=term ./tests

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
name: project
file: ./coverage.xml
flags: project
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
pyproject.toml

- name: Install latest compatible versions of immediate dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -e .[tests,dev]

- name: Run linters
run: |
pre-commit run --all-files

- name: Run tests
run: pytest -vv --cov-report=xml --cov-report=term ./tests

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
name: project
file: ./coverage.xml
flags: project
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

# <div align="center">optimade-maker</div>

[![PyPI - Version](https://img.shields.io/pypi/v/optimake?color=4CC61E)](https://pypi.org/project/optimake/)
[![PyPI - Version](https://img.shields.io/pypi/v/optimade-maker?color=4CC61E)](https://pypi.org/project/optimade-maker/)

Tools for making [OPTIMADE APIs](https://optimade.org) from various formats of structural data (e.g. an archive of CIF files).

This repository contains the `src/optimake` Python packages that work towards this aim. Features include
This repository contains the `src/optimade-maker` Python package and the corresponding CLI tool `optimake` that work towards this aim. Features include

- definition of a config file format (`optimade.yaml`) for annotating data archives to be used in the OPTIMADE ecosystem;
- conversion of the raw data into corresponding OPTIMADE types using pre-existing parsers (e.g., ASE for structures);
Expand All @@ -24,7 +24,7 @@ See `./examples` for a more complete set of supported formats and corresponding

### Annotating with `optimade.yaml`

To annotate your structural data for `optimake`, the data archive needs to be accompanied by an `optimade.yaml` config file. The following is a simple example for a zip archive (`structures.zip`) of cif files together with an optional property file (`data.csv`):
To annotate your structural data for `optimade-maker`, the data archive needs to be accompanied by an `optimade.yaml` config file. The following is a simple example for a zip archive (`structures.zip`) of cif files together with an optional property file (`data.csv`):

```yaml
config_version: 0.1.0
Expand All @@ -49,7 +49,7 @@ entries:

### Structure `id`s and property files

`optimake` will assign an `id` for each structure based on its full path in the archive, following a simple deterministic rule: from the set of all archive paths, the maximum common path prefix and postfix (including file extensions) are removed. E.g.
`optimade-maker` will assign an `id` for each structure based on its full path in the archive, following a simple deterministic rule: from the set of all archive paths, the maximum common path prefix and postfix (including file extensions) are removed. E.g.

```
structures.zip/cifs/set1/101.cif
Expand All @@ -71,7 +71,7 @@ structures.zip/cifs/set2/102.cif,3.2
Install with

```bash
pip install .
pip install optimade-maker
```

this will also make the `optimake` CLI utility available.
Expand All @@ -83,9 +83,9 @@ For a folder containing the data archive and the `optimade.yaml` file (such as i

For more detailed information see also `optimake --help`.

## `optimake` JSONLines Format
## `optimade-maker` JSONLines Format

As described above, `optimake` works via an intermediate JSONLines file representation of an OPTIMADE API (see also the [corresponding issue in the specification](https://github.com/Materials-Consortia/OPTIMADE/issues/471)).
As described above, `optimade-maker` works via an intermediate JSONLines file representation of an OPTIMADE API (see also the [corresponding issue in the specification](https://github.com/Materials-Consortia/OPTIMADE/issues/471)).
This file should provide enough metadata to spin up an OPTIMADE API with many different entry types.
The format is as follows:

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "optimake"
name = "optimade-maker"
description = "Tools for making OPTIMADE APIs from raw structural data."
readme = "README.md"
version = "0.2.2"
Expand Down Expand Up @@ -51,8 +51,8 @@ ignore_missing_imports = true
follow_imports = "skip"

[tool.isort]
known_first_party = "optimake"
known_first_party = "optimade_maker"
profile = "black"

[project.scripts]
optimake = "optimake.cli:cli"
optimake = "optimade_maker.cli:cli"
4 changes: 4 additions & 0 deletions src/optimade_maker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from optimade_maker.config import Config
from optimade_maker.convert import convert_archive

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

import requests

from optimake.config import Config
from optimade_maker.config import Config

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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import tqdm

from optimake.archive.archive_record import ArchiveRecord
from optimake.archive.utils import get_all_records, get_parsed_records
from optimade_maker.archive.archive_record import ArchiveRecord
from optimade_maker.archive.utils import get_all_records, get_parsed_records

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

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/optimake/cli.py → src/optimade_maker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import click

from optimake.convert import convert_archive
from optimake.logger import LOGGER
from optimake.serve import OptimakeServer
from optimade_maker.convert import convert_archive
from optimade_maker.logger import LOGGER
from optimade_maker.serve import OptimakeServer


@click.group()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/optimake/parsers.py → src/optimade_maker/parsers.py
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 optimake.config import PropertyDefinition
from optimade_maker.config import PropertyDefinition


def pybtex_to_optimade(bib_entry: Any, properties=None) -> EntryResource:
Expand Down
4 changes: 2 additions & 2 deletions src/optimake/serve.py → src/optimade_maker/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import bson.json_util
import uvicorn

from optimake.logger import LOGGER
from optimade_maker.logger import LOGGER


def get_optimake_provider_info(index_base_url=None):
info = {
"prefix": "optimake",
"name": "Optimake",
"description": "Provider created with optimake",
"description": "Provider created with optimade-maker",
"homepage": "https://github.com/materialscloud-org/optimade-maker",
"index_base_url": index_base_url,
}
Expand Down
4 changes: 0 additions & 4 deletions src/optimake/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions tests/test_archive.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import traceback

from optimake.config import UnsupportedConfigVersion
from optimade_maker.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 optimake.archive.archive_record import ArchiveRecord
from optimade_maker.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 optimake.archive.archive_record import ArchiveRecord
from optimade_maker.archive.archive_record import ArchiveRecord

try:
record = ArchiveRecord(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pytest
from optimade.models import EntryInfoResource
from optimake.convert import convert_archive
from optimade_maker.convert import convert_archive

EXAMPLE_ARCHIVES = (Path(__file__).parent.parent / "examples").glob("*")

Expand Down Expand Up @@ -98,7 +98,7 @@ def check_arrays(reference, test, field):
def test_unique_id_generator():
"""Unit tests for some common cases of the unique ID generator."""

from optimake.convert import _set_unique_entry_ids
from optimade_maker.convert import _set_unique_entry_ids

entry_ids = [
"data/structures/1.cif",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_yaml.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

import pytest
from optimake.config import Config
from optimade_maker.config import Config

EXAMPLE_YAMLS = (Path(__file__).parent.parent / "examples").glob("*/optimade.yaml")

Expand Down
Loading