From e49337c989a7901e5ce5d69a839188b021575a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 15:24:45 +0000 Subject: [PATCH] Update optimade[mongo] requirement from ~=0.17.2 to ~=0.18.0 (#357) * Update optimade[mongo] requirement from ~=0.17.2 to ~=0.18.0 Updates the requirements on [optimade[mongo]](https://github.com/Materials-Consortia/optimade-python-tools) to permit the latest version. - [Release notes](https://github.com/Materials-Consortia/optimade-python-tools/releases) - [Changelog](https://github.com/Materials-Consortia/optimade-python-tools/blob/master/CHANGELOG.md) - [Commits](https://github.com/Materials-Consortia/optimade-python-tools/compare/v0.17.2...v0.18.0) --- updated-dependencies: - dependency-name: optimade[mongo] dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update AiiDA/OPTIMADE * Use "default" instead of "const" * Use new `x-optimade-` prefixed extra schema keys Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: The AiiDA Team Co-authored-by: Casper Welzel Andersen --- Dockerfile | 2 +- README.md | 2 +- aiida_optimade/routers/info.py | 4 ++-- aiida_optimade/utils.py | 14 ++++++++++---- profiles/docker-compose-mongo.j2 | 2 +- profiles/docker-compose-mongo.yml | 2 +- profiles/docker-compose.j2 | 2 +- profiles/docker-compose.yml | 2 +- requirements.txt | 2 +- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00920652..16bf4eb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.8 WORKDIR /app # Install specific optimade and aiida-core versions -ARG OPTIMADE_TOOLS_VERSION=0.17.2 +ARG OPTIMADE_TOOLS_VERSION=0.18.0 ARG AIIDA_VERSION=1.6.8 # Copy repo contents diff --git a/README.md b/README.md index 685bbd3e..2aa061df 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | Latest release | Build status | Activity | |:--------------:|:------------:|:--------:| -| [![AiiDA](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/aiidateam/aiida-optimade/develop/.ci/aiida-version.json)](https://github.com/aiidateam/aiida-core/)
[![PyPI](https://img.shields.io/pypi/v/aiida-optimade)](https://pypi.org/project/aiida-optimade/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade/)
[![OPTIMADE](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/v0.17.2/optimade-version.json)](https://github.com/Materials-Consortia/OPTIMADE/) | [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/aiidateam/aiida-optimade/aiida-optimade)](https://github.com/aiidateam/aiida-optimade/actions/)
[![Codecov](https://img.shields.io/codecov/c/gh/aiidateam/aiida-optimade)](https://codecov.io/gh/aiidateam/aiida-optimade) | [![GitHub last commit](https://img.shields.io/github/last-commit/aiidateam/aiida-optimade)](https://github.com/aiidateam/aiida-optimade) | +| [![AiiDA](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/aiidateam/aiida-optimade/develop/.ci/aiida-version.json)](https://github.com/aiidateam/aiida-core/)
[![PyPI](https://img.shields.io/pypi/v/aiida-optimade)](https://pypi.org/project/aiida-optimade/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade/)
[![OPTIMADE](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/v0.18.0/optimade-version.json)](https://github.com/Materials-Consortia/OPTIMADE/) | [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/aiidateam/aiida-optimade/aiida-optimade)](https://github.com/aiidateam/aiida-optimade/actions/)
[![Codecov](https://img.shields.io/codecov/c/gh/aiidateam/aiida-optimade)](https://codecov.io/gh/aiidateam/aiida-optimade) | [![GitHub last commit](https://img.shields.io/github/last-commit/aiidateam/aiida-optimade)](https://github.com/aiidateam/aiida-optimade) | This is a RESTful API server created with [FastAPI](https://fastapi.tiangolo.com/) that exposes an AiiDA database according to the [OPTIMADE specification](https://github.com/Materials-Consortia/OPTIMADE/blob/develop/optimade.rst). diff --git a/aiida_optimade/routers/info.py b/aiida_optimade/routers/info.py index c2ff3ea7..498400de 100644 --- a/aiida_optimade/routers/info.py +++ b/aiida_optimade/routers/info.py @@ -38,8 +38,8 @@ def get_info(request: Request): return InfoResponse( meta=meta_values(str(request.url), 1, 1, more_data_available=False), data=BaseInfoResource( - id=BaseInfoResource.schema()["properties"]["id"]["const"], - type=BaseInfoResource.schema()["properties"]["type"]["const"], + id=BaseInfoResource.schema()["properties"]["id"]["default"], + type=BaseInfoResource.schema()["properties"]["type"]["default"], attributes=BaseInfoAttributes( api_version=__api_version__, available_api_versions=[ diff --git a/aiida_optimade/utils.py b/aiida_optimade/utils.py index eb213e80..7381faf1 100644 --- a/aiida_optimade/utils.py +++ b/aiida_optimade/utils.py @@ -34,15 +34,21 @@ def retrieve_queryable_properties( else: all_properties[name] = value properties[name] = {"description": value.get("description", "")} - for extra_key in ["unit"]: - if extra_key in value: - properties[name][extra_key] = value[extra_key] + for extra_key in ( + "x-optimade-unit", + "x-optimade-queryable", + "x-optimade-support", + ): + if value.get(extra_key) is not None: + properties[name][extra_key.replace("x-optimade-", "")] = value[ + extra_key + ] # AiiDA's QueryBuilder can sort everything that isn't a list (array) # or dict (object) properties[name]["sortable"] = value.get("type", "") not in [ "array", "object", - ] + ] and value.get("x-optimade-sortable", True) # Try to get OpenAPI-specific "format" if possible, # else get "type"; a mandatory OpenAPI key. properties[name]["type"] = DataType.from_json_type( diff --git a/profiles/docker-compose-mongo.j2 b/profiles/docker-compose-mongo.j2 index ac0da065..2f6fef20 100644 --- a/profiles/docker-compose-mongo.j2 +++ b/profiles/docker-compose-mongo.j2 @@ -10,7 +10,7 @@ services: context: .. dockerfile: Dockerfile args: - OPTIMADE_TOOLS_VERSION: 0.17.2 + OPTIMADE_TOOLS_VERSION: 0.18.0 AIIDA_VERSION: 1.6.8 CONFIG_FILE: aiida_optimade/config.json environment: diff --git a/profiles/docker-compose-mongo.yml b/profiles/docker-compose-mongo.yml index e44d7540..5b15b374 100644 --- a/profiles/docker-compose-mongo.yml +++ b/profiles/docker-compose-mongo.yml @@ -10,7 +10,7 @@ services: context: .. dockerfile: Dockerfile args: - OPTIMADE_TOOLS_VERSION: 0.17.2 + OPTIMADE_TOOLS_VERSION: 0.18.0 AIIDA_VERSION: 1.6.8 CONFIG_FILE: aiida_optimade/config.json environment: diff --git a/profiles/docker-compose.j2 b/profiles/docker-compose.j2 index 069dea31..5a4d6d6c 100644 --- a/profiles/docker-compose.j2 +++ b/profiles/docker-compose.j2 @@ -8,7 +8,7 @@ services: context: .. dockerfile: Dockerfile args: - OPTIMADE_TOOLS_VERSION: 0.17.2 + OPTIMADE_TOOLS_VERSION: 0.18.0 AIIDA_VERSION: 1.6.8 CONFIG_FILE: aiida_optimade/config.json environment: diff --git a/profiles/docker-compose.yml b/profiles/docker-compose.yml index 5e10c6ba..ca3cee82 100644 --- a/profiles/docker-compose.yml +++ b/profiles/docker-compose.yml @@ -8,7 +8,7 @@ services: context: .. dockerfile: Dockerfile args: - OPTIMADE_TOOLS_VERSION: 0.17.2 + OPTIMADE_TOOLS_VERSION: 0.18.0 AIIDA_VERSION: 1.6.8 CONFIG_FILE: aiida_optimade/config.json environment: diff --git a/requirements.txt b/requirements.txt index c21227a7..12b725b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ aiida-core~=1.6.8 -optimade[mongo]~=0.17.2 +optimade[mongo]~=0.18.0 pymatgen~=2021.3 uvicorn~=0.17.6