Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d4099c1
pd retrieval with delta backed
esoteric-ephemera Apr 21, 2026
26a4a5b
machinery for persistent query builder
esoteric-ephemera Apr 21, 2026
8f735b0
remove unused debug kwrag
esoteric-ephemera Apr 21, 2026
36eb8ce
align base and mp resters to inherit from same parent; cache delta table
esoteric-ephemera Apr 21, 2026
6fd4671
precommit
esoteric-ephemera Apr 21, 2026
b3874ea
query delta tables for electronic structure objects
esoteric-ephemera Apr 21, 2026
900e692
update static collection-backed endpoints
esoteric-ephemera Apr 21, 2026
d4344a1
move task trajectory to cached deltatable
esoteric-ephemera Apr 22, 2026
bca2ebc
change default to delta backed, mark certain endpoints as not delta b…
esoteric-ephemera Apr 22, 2026
f4d0348
add some default timeout params for deltatables + single entry point …
tsmathis Apr 30, 2026
2208fb5
resolve merge conflicts
tsmathis May 1, 2026
3f9bec4
pre-commit
tsmathis May 1, 2026
2655407
fix eos, task traj, add __dir__ to lazy import + fix attr access
esoteric-ephemera May 4, 2026
00c2423
remove print
esoteric-ephemera May 4, 2026
a43a82d
merge conf
esoteric-ephemera May 8, 2026
45f8e94
mypy
esoteric-ephemera May 8, 2026
95738fe
Merge remote-tracking branch 'origin/main' into emmet87
esoteric-ephemera May 12, 2026
81ee53b
subclass query builder to use saved delta tables
esoteric-ephemera May 12, 2026
85ff2fa
bump emmet-core into rc segment of v0.87.0
tsmathis May 12, 2026
51376d2
validate compound ids, pass user input as is
tsmathis May 12, 2026
d767a71
propagate rester kwargs
tsmathis May 12, 2026
2ab1906
task_id for dos is now root level for electronic_structure.dos field
tsmathis May 12, 2026
83ed143
rely on emmet for intermediate entry serialization
tsmathis May 12, 2026
8fafe14
coerce R2SCAN thermo_type to match source data
tsmathis May 13, 2026
a90d83d
update tests
tsmathis May 13, 2026
2f2c98f
pre-commit
tsmathis May 13, 2026
26ecec0
auto dependency upgrades
invalid-email-address May 13, 2026
65181db
pull in cached /properties from doc model to allow for battery/thermo…
esoteric-ephemera May 13, 2026
69241ac
small tweaks
esoteric-ephemera May 13, 2026
b94d805
revert endpoint
esoteric-ephemera May 13, 2026
5ab2ac2
update eos query params key, material_ids -> task_ids
tsmathis May 14, 2026
a82e1b9
update to known existing entries for chemenv test
tsmathis May 14, 2026
1a1d21a
update phonon rester to use new fields, maintain backwards compat wit…
tsmathis May 14, 2026
933aad0
test fixes
esoteric-ephemera May 15, 2026
92f684e
add configurable default return fields for sort test
tsmathis May 15, 2026
80e73bb
xas: material_ids -> task_ids with backwards compat
tsmathis May 15, 2026
28da883
allow for version setting via client
esoteric-ephemera May 15, 2026
d2d43f4
less golden test data
esoteric-ephemera May 15, 2026
ecfbbcd
refactor get stability test to not rely on golden test data
esoteric-ephemera May 15, 2026
2a229eb
remove localhost from settings
esoteric-ephemera May 15, 2026
bc43afa
phonon collection is delta_backed, rename phonon_ids -> identifiers
tsmathis May 16, 2026
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
2 changes: 1 addition & 1 deletion dev/generate_mcp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def regenerate_tools(
from datetime import datetime
from typing import Literal

from emmet.core.band_theory import BSPathType
from emmet.core.chemenv import (
COORDINATION_GEOMETRIES,
COORDINATION_GEOMETRIES_IUCR,
COORDINATION_GEOMETRIES_IUPAC,
COORDINATION_GEOMETRIES_NAMES,
)
from emmet.core.band_theory import BSPathType
from emmet.core.electronic_structure import DOSProjectionType
from emmet.core.grain_boundary import GBTypeEnum
from emmet.core.mpid import MPID
Expand Down
61 changes: 54 additions & 7 deletions mp_api/_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from __future__ import annotations

from enum import Enum

try:
import pytest
except ImportError as exc:
Expand Down Expand Up @@ -86,19 +88,64 @@ def client_search_testing(
assert doc[alt_name_dict.get(param, param)] is not None


def client_pagination(search_method: Callable, id_name: str):
page_1 = search_method(_page=1, chunk_size=NUM_DOCS, fields=[id_name])
page_2 = search_method(_page=2, chunk_size=NUM_DOCS, fields=[id_name])
def client_pagination(
search_method: Callable, id_name: str, additional_fields: list[str] | None = None
) -> None:
"""Test pagination on an endpoint.

Args:
search_method (Callable) : Client search method to use
id_name (str) : the name of a field which uniquely indexes a series of documents
additional_fields (list of str) : Optional other fields to retrieve.

Raises:
AssertionError if pagination does not result in unique sets of documents
"""
fields = [id_name, *(additional_fields or [])]
page_1 = search_method(_page=1, chunk_size=NUM_DOCS, fields=fields)
page_2 = search_method(_page=2, chunk_size=NUM_DOCS, fields=fields)
assert all(len(results) == NUM_DOCS for results in (page_1, page_2))
assert {str(getattr(doc, id_name)) for doc in page_1}.intersection(
{str(getattr(doc, id_name)) for doc in page_2}
) == set()


def client_sort(search_method: Callable, sort_fields: str | Sequence[str]):
def client_sort(
search_method: Callable,
sort_fields: str | Sequence[str],
aux_query: dict[str, Any] | None = None,
default_fields: tuple[str, ...] = ("deprecated", "material_id"),
):
"""Test sorting on an endpoint.

Args:
search_method (Callable) : Client search method to use
sort_fields (str or Sequence of str) : fields to sort on
aux_query (dict) : auxiliary query needed to filter documents
default_fields (list): default fields to return

Raises:
AssertionError if sorting in ascending or descending order does not work.
"""

def _normalize(doc, field: str):
v = getattr(doc, field)
# serialize enums
return v.value if isinstance(v, Enum) else v

user_query = {
k: v
for k, v in (aux_query or {}).items()
if k not in ("_page", "_sort_fields", "chunk_size", "fields")
}
for sort_field in [sort_fields] if isinstance(sort_fields, str) else sort_fields:

asc = search_method(
_page=1, _sort_fields=sort_field, chunk_size=NUM_DOCS, fields=[sort_field]
_page=1,
_sort_fields=sort_field,
chunk_size=NUM_DOCS,
fields=[sort_field, *default_fields],
**user_query,
)
desc = search_method(
_page=1,
Expand All @@ -108,12 +155,12 @@ def client_sort(search_method: Callable, sort_fields: str | Sequence[str]):
)

idxs = list(range(NUM_DOCS))
assert sorted(idxs, key=lambda idx: getattr(asc[idx], sort_field)) == idxs
assert sorted(idxs, key=lambda idx: _normalize(asc[idx], sort_field)) == idxs

assert (
sorted(
idxs,
key=lambda idx: getattr(desc[idx], sort_field),
key=lambda idx: _normalize(desc[idx], sort_field),
reverse=True,
)
== idxs
Expand Down
Loading
Loading