Skip to content
Closed
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
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
with:
submodules: true

- name: Set up Python 3.10
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand All @@ -56,10 +56,10 @@ jobs:
with:
submodules: true

- name: Set up Python 3.10
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down Expand Up @@ -227,27 +227,27 @@ jobs:
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/adapters/

- name: Run tests for validator only to assess coverage (mongomock)
if: matrix.python-version == 3.10
if: matrix.python-version == 3.9
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'mongomock'

- name: Run tests for validator only to assess coverage (Elasticsearch)
if: matrix.python-version == 3.10
if: matrix.python-version == 3.9
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'elastic'
OPTIMADE_INSERT_TEST_DATA: false # Must be specified as previous steps will have already inserted the test data

- name: Run tests for validator only to assess coverage (MongoDB)
if: matrix.python-version == 3.10
if: matrix.python-version == 3.9
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'mongodb'
OPTIMADE_INSERT_TEST_DATA: false # Must be specified as previous steps will have already inserted the test data

- name: Run the OPTIMADE Client CLI
if: matrix.python-version == 3.10
if: matrix.python-version == 3.9
run: |
coverage run --append --source optimade optimade/client/cli.py \
--filter 'nsites = 1' \
Expand Down Expand Up @@ -275,15 +275,15 @@ jobs:
coverage xml

- name: Upload coverage to Codecov
if: matrix.python-version == '3.10' && github.repository == 'Materials-Consortia/optimade-python-tools'
if: matrix.python-version == '3.9' && github.repository == 'Materials-Consortia/optimade-python-tools'
uses: codecov/codecov-action@v3
with:
name: project
file: ./coverage.xml
flags: project

- name: Upload validator coverage to Codecov
if: matrix.python-version == '3.10' && github.repository == 'Materials-Consortia/optimade-python-tools'
if: matrix.python-version == '3.9' && github.repository == 'Materials-Consortia/optimade-python-tools'
uses: codecov/codecov-action@v3
with:
name: validator
Expand All @@ -300,7 +300,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down Expand Up @@ -330,10 +330,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.10
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down
20 changes: 14 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.10
python: python3.9

repos:
- repo: https://github.com/ambv/black
Expand All @@ -9,7 +9,7 @@ repos:
name: Blacken

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-symlinks
- id: check-yaml
Expand All @@ -23,11 +23,17 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.291'
rev: 'v0.0.292'
hooks:
- id: ruff
args: [--fix]
args: [--fix, --exit-non-zero-on-fix]

- repo: local
hooks:
Expand All @@ -46,8 +52,10 @@ repos:
description: Update the API Reference documentation whenever a Python file is touched in the code base.

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.0
hooks:
- id: mypy
name: "MyPy"
additional_dependencies: ["types-all", "pydantic~=1.10"]
additional_dependencies: ["types-all", "pydantic~=2.0"]
exclude: ^tests/.*$
args: [--check-untyped-defs]
3 changes: 3 additions & 0 deletions docs/all_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ For example, the three OPTIMADE entry types, `structures`, `references` and `lin
As well as validating data types when creating instances of these models, this package defines several OPTIMADE-specific validators that ensure consistency between fields (e.g., the value of `nsites` matches the number of positions provided in `cartesian_site_positions`).

::: optimade.models
options:
show_submodules: true
show_if_no_docstring: true
5 changes: 5 additions & 0 deletions docs/api_reference/models/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# types

::: optimade.models.types
options:
show_if_no_docstring: true
25 changes: 17 additions & 8 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,38 @@ plugins:
lang: en
- mkdocstrings:
default_handler: python
enable_inventory: true
handlers:
python:
options:
# General options
show_source: true
show_bases: true

# Heading options
heading_level: 2
show_root_heading: false
show_root_toc_entry: true
show_root_full_path: true
show_object_full_path: false
show_category_heading: false
show_if_no_docstring: false
show_source: true
show_bases: true
group_by_category: true
heading_level: 2

# Members options
inherited_members: true
members: true
filters:
- "!^_[^_]"
- "!__json_encoder__$"
- "!__all__$"
- "!__config__$"
- "!ValidatorResults$"
members: true
inherited_members: true
group_by_category: true

# Docstring options
docstring_style: google
enable_inventory: true
docstring_options:
replace_admonitions: true
show_if_no_docstring: false
- awesome-pages
- autorefs

Expand Down
Loading