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

Update to OPTIMADE Python tools v0.7.0 #62

Merged
merged 4 commits into from
Mar 16, 2020
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:

- name: Upload coverage to Codecov
if: matrix.python-version == 3.7
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
xml: ./coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV AIIDA_PATH /app
WORKDIR /app

# Install specific optimade version
ARG OPTIMADE_TOOLS_VERSION=0.6.0
ARG OPTIMADE_TOOLS_VERSION=0.7.0
RUN pip install optimade==${OPTIMADE_TOOLS_VERSION}

# Install specific aiida-core version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Latest release | Build status | Activity |
|:--------------:|:------------:|:--------:|
| [![AiiDA](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/aiidateam/aiida-optimade/master/.ci/aiida-version.json)](https://github.com/aiidateam/aiida-core/)<br>[![PyPI](https://img.shields.io/pypi/v/aiida-optimade)](https://pypi.org/project/aiida-optimade/)<br>[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade/)<br>[![OPTiMaDe](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/v0.6.0/.ci/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/)<br>[![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/master/.ci/aiida-version.json)](https://github.com/aiidateam/aiida-core/)<br>[![PyPI](https://img.shields.io/pypi/v/aiida-optimade)](https://pypi.org/project/aiida-optimade/)<br>[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade/)<br>[![OPTiMaDe](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/v0.7.0/.ci/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/)<br>[![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).

Expand Down
2 changes: 1 addition & 1 deletion aiida_optimade/mappers/entries.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pylint: disable=arguments-differ
from typing import Tuple

from optimade.server.mappers import ResourceMapper as OptimadeResourceMapper
from optimade.server.mappers import BaseResourceMapper as OptimadeResourceMapper

from aiida_optimade.translators.entities import AiidaEntityTranslator

Expand Down
17 changes: 12 additions & 5 deletions aiida_optimade/transformers/aiida.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,23 @@ def string(self, string):
"""
return string.strip('"')

def number(self, arg):
@v_args(inline=True)
def signed_int(self, number):
"""
signed_int: SIGNED_INT
"""
return int(number)

@v_args(inline=True)
def number(self, number):
"""
number: SIGNED_INT | SIGNED_FLOAT
"""
token = arg[0]
if token.type == "SIGNED_INT":
if number.type == "SIGNED_INT":
type_ = int
elif token.type == "SIGNED_FLOAT":
elif number.type == "SIGNED_FLOAT":
type_ = float
return type_(token)
return type_(number)

def __default__(self, data, children, meta):
raise NotImplementedError(
Expand Down
2 changes: 1 addition & 1 deletion profiles/docker-compose.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: ..
dockerfile: Dockerfile
args:
OPTIMADE_TOOLS_VERSION: 0.6.0
OPTIMADE_TOOLS_VERSION: 0.7.0
AIIDA_VERSION: 1.1.1
environment:
AIIDA_PATH: /app
Expand Down
2 changes: 1 addition & 1 deletion profiles/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: ..
dockerfile: Dockerfile
args:
OPTIMADE_TOOLS_VERSION: 0.6.0
OPTIMADE_TOOLS_VERSION: 0.7.0
AIIDA_VERSION: 1.1.1
environment:
AIIDA_PATH: /app
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
install_requires=[
"aiida-core~=1.1.1",
"fastapi~=0.52",
"lark-parser~=0.8.1",
"optimade[mongo]~=0.6.0",
"lark-parser~=0.8.2",
"optimade[mongo]~=0.7.0",
"pydantic~=1.4",
"uvicorn",
"uvicorn~=0.11.3",
],
extras_require={"dev": DEV, "testing": TESTING},
**SETUP_JSON
Expand Down