Skip to content

Commit 67a5f0c

Browse files
Test up to p3.14 (#1091)
2 parents 061a41f + f77f19a commit 67a5f0c

23 files changed

Lines changed: 1784 additions & 69 deletions

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Python
1919
uses: actions/setup-python@v4
2020
with:
21-
python-version: "3.11"
21+
python-version: "3.12"
2222
cache: pip
2323

2424
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: actions/setup-python@v5
1818
with:
19-
python-version: 3.11
19+
python-version: 3.12
2020

2121
- name: Install dependencies
2222
run: |
@@ -36,20 +36,24 @@ jobs:
3636

3737
docs:
3838
runs-on: ubuntu-latest
39+
3940
needs:
4041
- deploy
4142

43+
env:
44+
PYTHON_VERSION: 3.12
45+
4246
steps:
4347
- uses: actions/checkout@v4
4448

4549
- uses: actions/setup-python@v5
4650
with:
47-
python-version: 3.11
51+
python-version: ${{ env.PYTHON_VERSION }}
4852

4953
- name: Install dependencies
5054
run: |
5155
python -m pip install --upgrade pip
52-
pip install -r requirements/requirements-ubuntu-latest_py3.11_extras.txt
56+
pip install -r requirements/requirements-ubuntu-latest_py${{ env.PYTHON_VERSION }}_extras.txt
5357
pip install -e .
5458
5559
- name: Build

.github/workflows/testing.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: ["ubuntu-latest"]
20-
python-version: ["3.11", "3.12"]
20+
python-version: ["3.12", "3.13", "3.14"]
2121

2222
runs-on: ${{ matrix.os }}
2323

@@ -43,24 +43,14 @@ jobs:
4343
if: matrix.os == 'windows-latest'
4444
run: echo "SSL_CERT_FILE=$(python -m certifi)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
4545

46-
- name: Format API key name (Linux/MacOS)
47-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
48-
run: |
49-
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}' | tr '[:lower:]' '[:upper:]')" >> $GITHUB_ENV
50-
51-
- name: Format API key name (Windows)
52-
if: matrix.os == 'windows-latest'
53-
run: |
54-
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}' | tr '[:lower:]' '[:upper:]')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
55-
5646
- name: Lint with mypy
5747
shell: bash -l {0}
5848
run: python -m mypy mp_api/
5949

6050
- name: Test with pytest
6151
if: always()
6252
env:
63-
MP_API_KEY: ${{ secrets[env.API_KEY_NAME] }}
53+
MP_API_KEY: ${{ secrets.MP_API_KEY_UBUNTU_LATEST_3_12 }}
6454
# MP_API_ENDPOINT: https://api-preview.materialsproject.org/
6555
run: |
6656
pytest -n auto -x --cov=mp_api --cov-report=xml

.github/workflows/upgrade_dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
os: ['ubuntu-latest']
1313
package: ["mp-api"]
14-
python-version: ["3.11", "3.12"]
14+
python-version: ["3.11", "3.12", "3.13", "3.14"]
1515
steps:
1616
- uses: actions/checkout@v4
1717
with:
@@ -49,7 +49,7 @@ jobs:
4949
needs: upgrade
5050
strategy:
5151
matrix:
52-
python-version: ["3.11"]
52+
python-version: ["3.12"]
5353
steps:
5454
- uses: actions/checkout@v4
5555
with:

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ ci:
66

77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.0.292
9+
rev: v0.15.12
1010
hooks:
1111
- id: ruff
1212
args: [--fix, --show-fixes]
1313

1414
- repo: https://github.com/psf/black
15-
rev: 23.9.1
15+
rev: 26.3.1
1616
hooks:
1717
- id: black
1818

1919
- repo: https://github.com/asottile/blacken-docs
20-
rev: "1.16.0"
20+
rev: "1.20.0"
2121
hooks:
2222
- id: blacken-docs
2323
additional_dependencies: [black>=23.7.0]
2424

2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.5.0
26+
rev: v6.0.0
2727
hooks:
2828
- id: check-case-conflict
2929
- id: check-symlinks
@@ -34,7 +34,7 @@ repos:
3434
- id: trailing-whitespace
3535

3636
- repo: https://github.com/codespell-project/codespell
37-
rev: v2.2.6
37+
rev: v2.4.2
3838
hooks:
3939
- id: codespell
4040
stages: [pre-commit, commit-msg]

mp_api/client/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Primary MAPI module."""
2+
23
from __future__ import annotations
34

45
import logging

mp_api/client/core/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def _submit_requests(
10451045
)
10461046

10471047
# Paginate through remaining results
1048-
skip = chunk_size if "_limit" not in criteria else criteria["_limit"]
1048+
skip = criteria.get("_limit") or chunk_size
10491049
remaining_docs = total_num_docs - initial_data_length
10501050

10511051
while total_data_len < num_docs_needed and remaining_docs > 0:

mp_api/client/mprester.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,13 @@ def get_entries(
662662
def get_pourbaix_entries(
663663
self,
664664
chemsys: str | list[str] | list[ComputedEntry | ComputedStructureEntry],
665-
solid_compat: Literal[
666-
"MaterialsProjectCompatibility", "MaterialsProject2020Compatibility"
667-
]
668-
| Compatibility
669-
| None = "MaterialsProject2020Compatibility",
665+
solid_compat: (
666+
Literal[
667+
"MaterialsProjectCompatibility", "MaterialsProject2020Compatibility"
668+
]
669+
| Compatibility
670+
| None
671+
) = "MaterialsProject2020Compatibility",
670672
use_gibbs: Literal[300] | None = None,
671673
) -> list[PourbaixEntry]:
672674
"""A helper function to get all entries necessary to generate
@@ -1389,13 +1391,11 @@ def query(*args, **kwargs):
13891391
Note this method also no longer supports direct MongoDB-type queries. For more information,
13901392
please see the new documentation.
13911393
"""
1392-
raise NotImplementedError(
1393-
"""
1394+
raise NotImplementedError("""
13941395
The MPRester().query method has been replaced with the MPRester().summary.search method.
13951396
Note this method also no longer supports direct MongoDB-type queries. For more information,
13961397
please see the new documentation.
1397-
"""
1398-
)
1398+
""")
13991399

14001400
def get_cohesive_energy(
14011401
self,

mp_api/client/routes/materials/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Define routes and imports to non-core materials resters."""
2+
23
from __future__ import annotations
34

45
from mp_api.client.core.utils import LazyImport

mp_api/client/routes/materials/chemenv.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ class ChemenvRester(BaseRester):
2222
def search(
2323
self,
2424
material_ids: str | list[str] | None = None,
25-
chemenv_iucr: COORDINATION_GEOMETRIES_IUCR
26-
| list[COORDINATION_GEOMETRIES_IUCR]
27-
| None = None,
28-
chemenv_iupac: COORDINATION_GEOMETRIES_IUPAC
29-
| list[COORDINATION_GEOMETRIES_IUPAC]
30-
| None = None,
31-
chemenv_name: COORDINATION_GEOMETRIES_NAMES
32-
| list[COORDINATION_GEOMETRIES_NAMES]
33-
| None = None,
34-
chemenv_symbol: COORDINATION_GEOMETRIES
35-
| list[COORDINATION_GEOMETRIES]
36-
| None = None,
25+
chemenv_iucr: (
26+
COORDINATION_GEOMETRIES_IUCR | list[COORDINATION_GEOMETRIES_IUCR] | None
27+
) = None,
28+
chemenv_iupac: (
29+
COORDINATION_GEOMETRIES_IUPAC | list[COORDINATION_GEOMETRIES_IUPAC] | None
30+
) = None,
31+
chemenv_name: (
32+
COORDINATION_GEOMETRIES_NAMES | list[COORDINATION_GEOMETRIES_NAMES] | None
33+
) = None,
34+
chemenv_symbol: (
35+
COORDINATION_GEOMETRIES | list[COORDINATION_GEOMETRIES] | None
36+
) = None,
3737
species: str | list[str] | None = None,
3838
elements: str | list[str] | None = None,
3939
exclude_elements: list[str] | None = None,

0 commit comments

Comments
 (0)