Skip to content

Commit

Permalink
Drop py38 (#500)
Browse files Browse the repository at this point in the history
Remove 3.8 from setup.json.
Use Python 3.9 in CI/CD.
Add support for Python 3.11.

Update readme compatibility matrix.
Expecting a v1.2 release after merging and updating
dependencies.

Run pyupgrade:
- pyupgrade --py37-plus.
- pyupgrade --py39-plus
  • Loading branch information
eimrek committed Nov 6, 2023
1 parent 7f7fc2f commit 1d3a7eb
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install Python dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_automerge_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false

- name: Setup Python 3.8
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install Python dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
with:
ref: ${{ env.DEFAULT_REPO_BRANCH }}

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install `pre-commit`
run: |
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install dependencies
run: |
Expand All @@ -45,7 +45,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']

services:
mongo:
Expand Down Expand Up @@ -105,14 +105,14 @@ jobs:
run: pytest -v --cov=./aiida_optimade/ --cov-report=xml:mongo_cov.xml --durations=20

- name: Upload coverage to Codecov
if: matrix.python-version == 3.8
if: matrix.python-version == 3.9
uses: codecov/codecov-action@v3
with:
flags: aiida
file: ./coverage.xml

- name: Upload coverage to Codecov
if: matrix.python-version == 3.8
if: matrix.python-version == 3.9
uses: codecov/codecov-action@v3
with:
flags: mongo
Expand Down Expand Up @@ -148,10 +148,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install python dependencies
run: |
Expand Down Expand Up @@ -223,10 +223,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install python dependencies
run: |
Expand Down Expand Up @@ -292,10 +292,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Install python dependencies
run: |
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ The compatibility matrix below assumes the user always install the latest patch

| Plugin | AiiDA | Python | Specification |
|-|-|-|-|
| `v1.0 < v2.0` | ![Compatibility for v1.0][AiiDA v2 range] | [![PyPI pyversions](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade) | ![OPTIMADE API compatibility][OPTIMADE from OPT] |
| `v1.2 < v2.0` | ![Compatibility for v1.0][AiiDA v2 py311 range] | [![PyPI pyversions](https://img.shields.io/pypi/pyversions/aiida-optimade)](https://pypi.org/project/aiida-optimade) | ![OPTIMADE API compatibility][OPTIMADE from OPT] |
| `v1.0 < v1.2` | ![Compatibility for v1.0][AiiDA v2 py38 range] | [![PyPI pyversions][Python v3.8-v3.10]](https://pypi.org/project/aiida-optimade/1.1.1/) | ![OPTIMADE API compatibility][OPTIMADE from OPT] |
| `v0.18 <= v0.20` | ![Compatibility for v0][AiiDA v1 range] | [![PyPI pyversions][Python v3.7-v3.9]](https://pypi.org/project/aiida-optimade/0.20.0/) | ![OPTIMADE API compatibility][OPTIMADE from OPT] |

| Latest release | Build status | Activity |
Expand Down Expand Up @@ -171,10 +172,15 @@ The release action will be triggered by newly created release.
Note, the tag should start with a `v` and be followed by a full semantic version (see [SemVer](https://semver.org)).
For example: `v2.3.12`.

[AiiDA v2 range]: https://img.shields.io/badge/AiiDA->=2.0.0,<3.0.0-007ec6.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAhCAYAAABTERJSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAFhgAABYYBG6Yz4AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAUbSURBVFiFzZhrbFRVEMd%2Fc%2B5uu6UUbIFC%2FUAUVEQCLbQJBIiBDyiImJiIhmohYNCkqJAQxASLF8tDgYRHBLXRhIcKNtFEhVDgAxBJqgmVh4JEKg3EIn2QYqBlt917xg%2BFss%2ByaDHOtzsz5z%2B%2FuZl7ztmF%2F5HJvxVQN6cPYX8%2FPLnOmsvNAvqfwuib%2FbNIk9cQeQnLcKRL5xLIV%2Fic9eJeunjPYbRs4FjQSpTB3aS1IpRKeeOOewajy%2FKKEO8Q0DuVdKy8IqsbPulxGHUfCBBu%2BwUYGuFuBTK7wQnht6PEbf4tlRomVRjCbXNjQEB0AyrFQOL5ENIJm7dTLZE6DPJCnEtFZVXDLny%2B4Sjv0PmmYu1ZdUek9RiMgoDmJ8V0L7XJqsZ3UW8YsBOwEeHeeFce7jEYXBy0m9m4BbXqSj2%2Bxnkg26MCVrN6DEZcwggtd8pTFx%2Fh3B9B50YLaFOP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y8tNF3Rt0CSXb6bRFl4%2FIfQzNMjaE9WwpYOWQnOdEF%2BTdJNO0iFh7%2BI0kfORzQZb6P2kymS9oTxzBiM9rUqLWr1WE5G6ODhycQd%2FUnNVeMbcH68hYkGycNoUNWc8fxaxfwhDbHpfwM5oeTY7rUX8QAAAABJRU5ErkJggg%3D%3D


[Python v3.8-v3.10]: https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue

[Python v3.7-v3.9]: https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9-blue

[OPTIMADE from OPT]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Materials-Consortia/optimade-python-tools/v0.24.1/optimade-version.json
5 changes: 3 additions & 2 deletions aiida_optimade/cli/cmd_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from aiida_optimade.common.logger import LOGGER, disable_logging

if TYPE_CHECKING: # pragma: no cover
from typing import IO, Generator, Iterator, List, Union
from collections.abc import Generator, Iterator
from typing import IO, List, Union

from aiida.common.extendeddicts import AttributeDict

Expand Down Expand Up @@ -153,7 +154,7 @@ def init(obj: "AttributeDict", force: bool, silent: bool, mongo: bool, filename:
"consider using --force to first drop the collection, if possible."
)

with open(filename, "r") as handle:
with open(filename) as handle:
if silent:
all_chunks = read_chunks(handle, chunk_size=chunk_size)
else:
Expand Down
36 changes: 18 additions & 18 deletions aiida_optimade/entry_collections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import warnings
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from typing import Any, Optional, Union

from aiida.orm import Group
from aiida.orm.nodes import Node
Expand Down Expand Up @@ -31,7 +31,7 @@ class AiidaCollection(EntryCollection):

def __init__(
self,
entities: Union[str, List[str]],
entities: Union[str, list[str]],
group: Optional[str],
resource_cls: EntryResource,
resource_mapper: ResourceMapper,
Expand All @@ -48,15 +48,15 @@ def __init__(
# "Cache"
self._data_available: int = None
self._data_returned: int = None
self._extras_fields: Set[str] = None
self._latest_filter: Dict[str, Any] = None
self._count: Dict[str, Any] = None
self._extras_fields: set[str] = None
self._latest_filter: dict[str, Any] = None
self._count: dict[str, Any] = None
self._checked_extras_filter_fields: set = set()

self._all_fields: Set[str] = None
self._all_fields: set[str] = None

@property
def all_fields(self) -> Set[str]:
def all_fields(self) -> set[str]:
if not self._all_fields:
self._all_fields = super().all_fields
return self._all_fields
Expand Down Expand Up @@ -114,7 +114,7 @@ def _clear_cache(self) -> None:
def __len__(self) -> int:
return self.data_available

def insert(self, _: List[EntryResource]) -> None:
def insert(self, _: list[EntryResource]) -> None:
raise NotImplementedError(
f"The insert method is not implemented for {self.__class__.__name__}."
)
Expand Down Expand Up @@ -175,8 +175,8 @@ def count(self, **kwargs) -> int:

def find( # pylint: disable=too-many-branches
self, params: Union[EntryListingQueryParams, SingleEntryQueryParams]
) -> Tuple[
Union[List[EntryResource], EntryResource, None], int, bool, Set[str], Set[str]
) -> tuple[
Union[list[EntryResource], EntryResource, None], int, bool, set[str], set[str]
]:
self.set_data_available()

Expand Down Expand Up @@ -266,8 +266,8 @@ def find( # pylint: disable=too-many-branches
)

def _run_db_query(
self, criteria: Dict[str, Any], single_entry: bool = False
) -> Tuple[List[Dict[str, Any]], bool]:
self, criteria: dict[str, Any], single_entry: bool = False
) -> tuple[list[dict[str, Any]], bool]:
"""Run the query on the backend and collect the results.
Arguments:
Expand Down Expand Up @@ -296,7 +296,7 @@ def _run_db_query(

@staticmethod
def _prepare_query(
node_types: List[str], group: Optional[str] = None, **kwargs
node_types: list[str], group: Optional[str] = None, **kwargs
) -> QueryBuilder:
"""Workhorse function to prepare an AiiDA QueryBuilder query"""
for key in kwargs:
Expand Down Expand Up @@ -344,7 +344,7 @@ def _perform_count(self, **kwargs) -> int:

def handle_query_params(
self, params: Union[EntryListingQueryParams, SingleEntryQueryParams]
) -> Dict[str, Any]:
) -> dict[str, Any]:
"""Parse and interpret the backend-agnostic query parameter models into a
dictionary that can be used by AiiDA's QueryBuilder.
Expand Down Expand Up @@ -385,7 +385,7 @@ def handle_query_params(

return cursor_kwargs

def parse_sort_params(self, sort_params: str) -> List[Dict[str, Dict[str, str]]]:
def parse_sort_params(self, sort_params: str) -> list[dict[str, dict[str, str]]]:
"""Handles any sort parameters passed to the collection,
resolving aliases and dealing with any invalid fields.
Expand Down Expand Up @@ -473,8 +473,8 @@ def __filter_fields_util( # pylint: disable=unused-private-member
__filter_fields_util(deepcopy(filters))

def _check_and_calculate_entities(
self, cli: bool = False, entries: List[List[int]] = None
) -> List[int]:
self, cli: bool = False, entries: list[list[int]] = None
) -> list[int]:
"""Check all entities have OPTIMADE extras, else calculate them
For a bit of optimization, we only care about a field if it has specifically
Expand All @@ -490,7 +490,7 @@ def _check_and_calculate_entities(
"""

def _update_entities(entities: List[List[Any]], fields: List[str]):
def _update_entities(entities: list[list[Any]], fields: list[str]):
"""Utility function to update entities within this method"""
optimade_fields = [
self.resource_mapper.get_optimade_field(_) for _ in fields
Expand Down
14 changes: 7 additions & 7 deletions aiida_optimade/mappers/entries.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pylint: disable=arguments-differ
from typing import Any, Dict, Set, Tuple
from typing import Any

from optimade.server.mappers import BaseResourceMapper as OptimadeResourceMapper

Expand All @@ -13,9 +13,9 @@ class ResourceMapper(OptimadeResourceMapper):

PROJECT_PREFIX: str = "extras.optimade."

TRANSLATORS: Dict[str, AiidaEntityTranslator]
REQUIRED_ATTRIBUTES: Set[str] = set()
TOP_LEVEL_NON_ATTRIBUTES_FIELDS: Set[str] = {
TRANSLATORS: dict[str, AiidaEntityTranslator]
REQUIRED_ATTRIBUTES: set[str] = set()
TOP_LEVEL_NON_ATTRIBUTES_FIELDS: set[str] = {
"id",
"type",
"relationships",
Expand All @@ -24,11 +24,11 @@ class ResourceMapper(OptimadeResourceMapper):
}

@classmethod
def all_aliases(cls) -> Tuple[Tuple[str, str]]:
def all_aliases(cls) -> tuple[tuple[str, str]]:
"""Get all aliases as a tuple
Also add `PROJECT_PREFIX` fields to the tuple
"""
res = super(ResourceMapper, cls).all_aliases()
res = super().all_aliases()
return res + tuple(
(field, f"{cls.PROJECT_PREFIX}{field}")
for field in set(cls.ENTRY_RESOURCE_ATTRIBUTES.keys())
Expand All @@ -37,7 +37,7 @@ def all_aliases(cls) -> Tuple[Tuple[str, str]]:
)

@classmethod
def map_back(cls, entity_properties: Dict[str, Any]) -> dict:
def map_back(cls, entity_properties: dict[str, Any]) -> dict:
"""Map properties from AiiDA to OPTIMADE
Parameters:
Expand Down
3 changes: 1 addition & 2 deletions aiida_optimade/mappers/structures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import warnings
from typing import Dict

from optimade.server.config import CONFIG, SupportedBackend

Expand All @@ -19,7 +18,7 @@
class StructureMapper(ResourceMapper):
"""Map 'structure' resources from OPTIMADE to AiiDA"""

TRANSLATORS: Dict[str, AiidaEntityTranslator] = {
TRANSLATORS: dict[str, AiidaEntityTranslator] = {
"data.core.cif.CifData.": CifDataTranslator,
"data.core.structure.StructureData.": StructureDataTranslator,
}
Expand Down
Loading

0 comments on commit 1d3a7eb

Please sign in to comment.