Skip to content

Commit 925a5b7

Browse files
committed
Merged changes from master.
2 parents 309ff36 + 105b501 commit 925a5b7

File tree

120 files changed

+1159
-950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1159
-950
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
pip install -U setuptools wheel
6161
pip install -e .
6262
pip install -r requirements.txt
63+
pip install -r requirements-server.txt
6364
pip install -r requirements-dev.txt
6465
6566
- name: Run pre-commit
@@ -85,6 +86,7 @@ jobs:
8586
pip install -U setuptools wheel
8687
pip install -e .
8788
pip install -r requirements.txt
89+
pip install -r requirements-server.txt
8890
pip install -r requirements-dev.txt
8991
9092
- name: Pass generated OpenAPI schemas through validator.swagger.io
@@ -194,25 +196,29 @@ jobs:
194196
pip install -r requirements-dev.txt
195197
pip install -r requirements-http-client.txt
196198
197-
- name: Run all tests (using `mongomock`)
198-
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml tests/
199+
- name: Run non-server tests
200+
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml tests/ --ignore tests/server
201+
202+
- name: Install latest server dependencies
203+
run: pip install -r requirements-server.txt
204+
205+
- name: Run server tests (using `mongomock`)
206+
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers
199207
env:
200208
OPTIMADE_DATABASE_BACKEND: 'mongomock'
201209

202-
203210
- name: Run server tests (using a real MongoDB)
204-
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server
211+
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers
205212
env:
206213
OPTIMADE_DATABASE_BACKEND: 'mongodb'
207214

208215
- name: Run server tests (using Elasticsearch)
209-
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server
216+
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers
210217
env:
211218
OPTIMADE_DATABASE_BACKEND: 'elastic'
212219

213220
- name: Install adapter conversion dependencies
214-
run: |
215-
pip install -r requirements-client.txt
221+
run: pip install -r requirements-client.txt
216222

217223
- name: Setup environment for AiiDA
218224
env:
@@ -305,6 +311,7 @@ jobs:
305311
pip install -U setuptools wheel
306312
pip install -e .
307313
pip install -r requirements.txt
314+
pip install -r requirements-server.txt
308315
pip install -r requirements-dev.txt
309316
pip install -r requirements-http-client.txt
310317
pip install -r requirements-docs.txt

.pre-commit-config.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
name: Blacken
1010

1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.3.0
12+
rev: v4.4.0
1313
hooks:
1414
- id: check-symlinks
1515
- id: check-yaml
@@ -24,7 +24,7 @@ repos:
2424
args: [--markdown-linebreak-ext=md]
2525

2626
- repo: https://github.com/pycqa/flake8
27-
rev: '5.0.4'
27+
rev: '6.0.0'
2828
hooks:
2929
- id: flake8
3030

@@ -43,3 +43,16 @@ repos:
4343
pass_filenames: false
4444
files: ^optimade/.*\.py$
4545
description: Update the API Reference documentation whenever a Python file is touched in the code base.
46+
47+
- repo: https://github.com/pre-commit/mirrors-mypy
48+
rev: v0.991
49+
hooks:
50+
- id: mypy
51+
name: "MyPy"
52+
additional_dependencies: ["types-all", "pydantic~=1.10"]
53+
54+
- repo: https://github.com/PyCQA/isort
55+
rev: 5.10.1
56+
hooks:
57+
- id: isort
58+
name: "isort"

CHANGELOG.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,60 @@
22

33
## [Unreleased](https://github.com/Materials-Consortia/optimade-python-tools/tree/HEAD)
44

5-
[Full Changelog](https://github.com/Materials-Consortia/optimade-python-tools/compare/v0.19.4...HEAD)
5+
[Full Changelog](https://github.com/Materials-Consortia/optimade-python-tools/compare/v0.20.0...HEAD)
66

7-
This is a hotfix release for #1335, a bug regarding chunked responses triggered when using the latest FastAPI version.
7+
This release continues the modularisation of the package by moving the server exceptions and warnings out into top-level modules, and removing the core dependency on FastAPI (now a server dependency only). This should allow for easier use of the `optimade.models` and `optimade.client` modules within other packages.
8+
9+
Aside from that, the package now supports Python 3.11, and our example server is now deployed at [Fly.io](https://optimade.fly.dev) rather than Heroku.
10+
11+
## [v0.20.0](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.20.0) (2022-11-29)
12+
13+
[Full Changelog](https://github.com/Materials-Consortia/optimade-python-tools/compare/v0.19.4...v0.20.0)
14+
15+
This release continues the modularisation of the package by moving the server exceptions and warnings out into top-level modules, and removing the core dependency on FastAPI (now a server dependency only). This should allow for easier use of the `optimade.models` and `optimade.client` modules within other packages.
16+
17+
Aside from that, the package now supports Python 3.11, and our example server is now deployed at [Fly.io](https://optimade.fly.dev) rather than Heroku.
18+
19+
**Implemented enhancements:**
20+
21+
- Add support for Python 3.11 [\#1361](https://github.com/Materials-Consortia/optimade-python-tools/issues/1361)
22+
- Improve test diagnostics and fix deprecated Elasticsearch calls [\#1373](https://github.com/Materials-Consortia/optimade-python-tools/pull/1373) ([ml-evs](https://github.com/ml-evs))
23+
- Support Python 3.11 [\#1362](https://github.com/Materials-Consortia/optimade-python-tools/pull/1362) ([ml-evs](https://github.com/ml-evs))
824

925
**Fixed bugs:**
1026

11-
- UnboundLocalError - `chunk_size` is not always set in middleware method [\#1335](https://github.com/Materials-Consortia/optimade-python-tools/issues/1335)
27+
- Elasticsearch pytest oneliner in the docs is no longer working [\#1377](https://github.com/Materials-Consortia/optimade-python-tools/issues/1377)
28+
- Remote swagger validator has changed output format [\#1370](https://github.com/Materials-Consortia/optimade-python-tools/issues/1370)
29+
30+
**Closed issues:**
31+
32+
- Fully isolate server code from other submodules [\#1403](https://github.com/Materials-Consortia/optimade-python-tools/issues/1403)
33+
- Replace https://gitlab.com/pycqa/flake8 with https://github.com/pycqa/flake8 [\#1388](https://github.com/Materials-Consortia/optimade-python-tools/issues/1388)
34+
- OpenAPI schema should not enforce recommended constraint on `page_number` [\#1372](https://github.com/Materials-Consortia/optimade-python-tools/issues/1372)
35+
- Pydantic models docs are broken on the mkdocs site with new renderer [\#1353](https://github.com/Materials-Consortia/optimade-python-tools/issues/1353)
36+
- Migrate away from Heroku for demo server [\#1307](https://github.com/Materials-Consortia/optimade-python-tools/issues/1307)
37+
- FastAPI should not be a core dependency [\#1198](https://github.com/Materials-Consortia/optimade-python-tools/issues/1198)
38+
39+
**Merged pull requests:**
40+
41+
- Move exceptions and warnings out of server code and separate deps [\#1405](https://github.com/Materials-Consortia/optimade-python-tools/pull/1405) ([ml-evs](https://github.com/ml-evs))
42+
- Complete migration from Heroku to Fly [\#1400](https://github.com/Materials-Consortia/optimade-python-tools/pull/1400) ([ml-evs](https://github.com/ml-evs))
43+
- Add GH actions for deploying example server to Fly [\#1396](https://github.com/Materials-Consortia/optimade-python-tools/pull/1396) ([ml-evs](https://github.com/ml-evs))
44+
- Support new remote swagger.io validator format [\#1371](https://github.com/Materials-Consortia/optimade-python-tools/pull/1371) ([ml-evs](https://github.com/ml-evs))
45+
- Do not enforce minimum value of `page_number` at model level [\#1369](https://github.com/Materials-Consortia/optimade-python-tools/pull/1369) ([ml-evs](https://github.com/ml-evs))
46+
- Enable `mypy` and `isort` in pre-commit & CI [\#1346](https://github.com/Materials-Consortia/optimade-python-tools/pull/1346) ([ml-evs](https://github.com/ml-evs))
47+
- Remove randomness from structure utils tests [\#1338](https://github.com/Materials-Consortia/optimade-python-tools/pull/1338) ([ml-evs](https://github.com/ml-evs))
48+
- Demote FastAPI to a server dep only [\#1199](https://github.com/Materials-Consortia/optimade-python-tools/pull/1199) ([ml-evs](https://github.com/ml-evs))
1249

1350
## [v0.19.4](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.19.4) (2022-09-19)
1451

1552
[Full Changelog](https://github.com/Materials-Consortia/optimade-python-tools/compare/v0.19.3...v0.19.4)
1653

54+
This is a hotfix release for #1335, a bug regarding chunked responses triggered when using the latest FastAPI version.
55+
1756
**Fixed bugs:**
1857

58+
- UnboundLocalError - `chunk_size` is not always set in middleware method [\#1335](https://github.com/Materials-Consortia/optimade-python-tools/issues/1335)
1959
- Ensure `chunk_size` is properly set when chunking responses [\#1336](https://github.com/Materials-Consortia/optimade-python-tools/pull/1336) ([ml-evs](https://github.com/ml-evs))
2060

2161
## [v0.19.3](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.19.3) (2022-09-06)

docs/api_reference/exceptions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# exceptions
2+
3+
::: optimade.exceptions

docs/api_reference/utils.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# utils
2+
3+
::: optimade.utils

docs/api_reference/warnings.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# warnings
2+
3+
::: optimade.warnings

docs/static/default_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"base_url": null,
1414
"implementation": {
1515
"name": "OPTIMADE Python Tools",
16-
"version": "0.19.4",
16+
"version": "0.20.0",
1717
"source_url": "https://github.com/Materials-Consortia/optimade-python-tools",
1818
"maintainer": {"email": "[email protected]"}
1919
},

openapi/index_openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"openapi": "3.0.2",
33
"info": {
44
"title": "OPTIMADE API - Index meta-database",
5-
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\nThis is the \"special\" index meta-database.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.19.4) v0.19.4.",
5+
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\nThis is the \"special\" index meta-database.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.20.0) v0.20.0.",
66
"version": "1.1.0"
77
},
88
"paths": {

openapi/openapi.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"openapi": "3.0.2",
33
"info": {
44
"title": "OPTIMADE API",
5-
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.19.4) v0.19.4.",
5+
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v0.20.0) v0.20.0.",
66
"version": "1.1.0"
77
},
88
"paths": {
@@ -3359,9 +3359,9 @@
33593359
"type": "number"
33603360
},
33613361
"description": "If present MUST be a list of floats expressed in a.m.u.\nElements denoting vacancies MUST have masses equal to 0.",
3362-
"x-optimade-unit": "a.m.u.",
33633362
"x-optimade-support": "optional",
3364-
"x-optimade-queryable": "optional"
3363+
"x-optimade-queryable": "optional",
3364+
"x-optimade-unit": "a.m.u."
33653365
},
33663366
"original_name": {
33673367
"title": "Original Name",
@@ -3639,9 +3639,9 @@
36393639
},
36403640
"description": "The three lattice vectors in Cartesian coordinates, in \u00e5ngstr\u00f6m (\u00c5).\n\n- **Type**: list of list of floats or unknown values.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - MUST be a list of three vectors *a*, *b*, and *c*, where each of the vectors MUST BE a list of the vector's coordinates along the x, y, and z Cartesian coordinates.\n (Therefore, the first index runs over the three lattice vectors and the second index runs over the x, y, z Cartesian coordinates).\n - For databases that do not define an absolute Cartesian system (e.g., only defining the length and angles between vectors), the first lattice vector SHOULD be set along *x* and the second on the *xy*-plane.\n - MUST always contain three vectors of three coordinates each, independently of the elements of property `dimension_types`.\n The vectors SHOULD by convention be chosen so the determinant of the `lattice_vectors` matrix is different from zero.\n The vectors in the non-periodic directions have no significance beyond fulfilling these requirements.\n - The coordinates of the lattice vectors of non-periodic dimensions (i.e., those dimensions for which `dimension_types` is `0`) MAY be given as a list of all `null` values.\n If a lattice vector contains the value `null`, all coordinates of that lattice vector MUST be `null`.\n\n- **Examples**:\n - `[[4.0,0.0,0.0],[0.0,4.0,0.0],[0.0,1.0,4.0]]` represents a cell, where the first vector is `(4, 0, 0)`, i.e., a vector aligned along the `x` axis of length 4 \u00c5; the second vector is `(0, 4, 0)`; and the third vector is `(0, 1, 4)`.",
36413641
"nullable": true,
3642-
"x-optimade-unit": "\u00c5",
36433642
"x-optimade-support": "should",
3644-
"x-optimade-queryable": "optional"
3643+
"x-optimade-queryable": "optional",
3644+
"x-optimade-unit": "\u00c5"
36453645
},
36463646
"cartesian_site_positions": {
36473647
"title": "Cartesian Site Positions",
@@ -3656,9 +3656,9 @@
36563656
},
36573657
"description": "Cartesian positions of each site in the structure.\nA site is usually used to describe positions of atoms; what atoms can be encountered at a given site is conveyed by the `species_at_sites` property, and the species themselves are described in the `species` property.\n\n- **Type**: list of list of floats\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - It MUST be a list of length equal to the number of sites in the structure, where every element is a list of the three Cartesian coordinates of a site expressed as float values in the unit angstrom (\u00c5).\n - An entry MAY have multiple sites at the same Cartesian position (for a relevant use of this, see e.g., the property `assemblies`).\n\n- **Examples**:\n - `[[0,0,0],[0,0,2]]` indicates a structure with two sites, one sitting at the origin and one along the (positive) *z*-axis, 2 \u00c5 away from the origin.",
36583658
"nullable": true,
3659-
"x-optimade-unit": "\u00c5",
36603659
"x-optimade-support": "should",
3661-
"x-optimade-queryable": "optional"
3660+
"x-optimade-queryable": "optional",
3661+
"x-optimade-unit": "\u00c5"
36623662
},
36633663
"nsites": {
36643664
"title": "Nsites",

optimade/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.19.4"
1+
__version__ = "0.20.0"
22
__api_version__ = "1.1.0"

0 commit comments

Comments
 (0)