Skip to content

Commit

Permalink
Remove provider prefix config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Oct 9, 2023
1 parent 3ada4a7 commit e58aefa
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/mc_optimade/examples/bzipped_pymatgen/optimade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ config_version: 0.1.0
database_description: >-
This database contains some bzipped pymatgen objects.
provider_prefix: mcloudarchive

entries:
- entry_type: structures
entry_paths:
Expand Down
2 changes: 0 additions & 2 deletions src/mc_optimade/examples/direct_from_jsonl/optimade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ config_version: 0.1.0
database_description: >-
This database contains some example CIFs.
provider_prefix: mcloudarchive

entries:
jsonl_path: example.jsonl
2 changes: 0 additions & 2 deletions src/mc_optimade/examples/folder_of_cifs/optimade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ config_version: 0.1.0
database_description: >-
This database contains some example CIFs.
provider_prefix: mcloudarchive

entries:
- entry_type: structures
entry_paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ config_version: 0.1.0
database_description: >-
This database contains 3 xyz files, one of which should be excluded from the API.
provider_prefix: mcloudarchive

entries:
- entry_type: structures
entry_paths:
Expand Down
5 changes: 0 additions & 5 deletions src/mc_optimade/mc_optimade/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ class Config(BaseModel):
description="A list of entry configurations for each entry type."
)

provider_prefix: str = Field(
"",
description="A provider prefix to use for custom fields served by this API.",
)

@validator("entries")
def check_one_entry_per_type(cls, v):
if not isinstance(v, JSONLConfig):
Expand Down
7 changes: 5 additions & 2 deletions src/mc_optimade/mc_optimade/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
import warnings
from collections import defaultdict
from pathlib import Path
Expand All @@ -16,6 +17,8 @@
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")


def _construct_entry_type_info(
type: str,
Expand Down Expand Up @@ -87,7 +90,7 @@ def convert_archive(archive_path: Path) -> Path:

for entry in mc_config.entries:
optimade_entries[entry.entry_type].extend(
construct_entries(archive_path, entry, mc_config.provider_prefix).values()
construct_entries(archive_path, entry, PROVIDER_PREFIX).values()
)

property_definitions = defaultdict(list)
Expand All @@ -98,7 +101,7 @@ def convert_archive(archive_path: Path) -> Path:
archive_path,
optimade_entries,
property_definitions,
mc_config.provider_prefix,
PROVIDER_PREFIX,
)

return jsonl_path
Expand Down

0 comments on commit e58aefa

Please sign in to comment.