Skip to content

Commit 96b2b82

Browse files
janoshutf
andauthored
Bump min supported Python to 3.10 (#992)
* obj.__class__.__name__ -> type(maker).__name__ * bump ruff target-version to py310 and fix errors * pyproject bump requires-python = ">=3.9", testing.yml drop 3.9 CI, README.md add badge showing min supported Python version * missed some python-version: 3.9 in GH wfs * fix outdated docs saying atomate2 supports py3.8+ * add Python 3.12 to supported versions and test in CI * fix multiple level 1 headings in docs/user/codes/openmm.md * quippy-ase==0.9.14; python_version < '3.12' * "tblite>=0.3.0; python_version < '3.12'" * try zip(strict=True) everywhere * ruff --------- Co-authored-by: Alex Ganose <utf@users.noreply.github.com>
1 parent 79aaf15 commit 96b2b82

Some content is hidden

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

48 files changed

+158
-130
lines changed

.github/workflows/testing.yml

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

1818
- uses: actions/setup-python@v5
1919
with:
20-
python-version: "3.9"
20+
python-version: "3.10"
2121
cache: pip
2222
cache-dependency-path: pyproject.toml
2323

@@ -36,7 +36,7 @@ jobs:
3636
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
3737
strategy:
3838
matrix:
39-
python-version: ["3.9", "3.10", "3.11"]
39+
python-version: ["3.10", "3.11", "3.12"]
4040

4141
steps:
4242
- name: Check out repo
@@ -103,7 +103,7 @@ jobs:
103103
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
104104
strategy:
105105
matrix:
106-
python-version: ["3.9", "3.10", "3.11"]
106+
python-version: ["3.10", "3.11", "3.12"]
107107

108108
steps:
109109
- name: Check out repo

.github/workflows/update-precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.9
18+
python-version: "3.10"
1919

2020
- name: Install pre-commit
2121
run: pip install pre-commit

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_language_version:
33
exclude: ^(.github/|tests/test_data/abinit/)
44
repos:
55
- repo: https://github.com/charliermarsh/ruff-pre-commit
6-
rev: v0.6.1
6+
rev: v0.6.7
77
hooks:
88
- id: ruff
99
args: [--fix]
@@ -30,7 +30,7 @@ repos:
3030
- id: rst-directive-colons
3131
- id: rst-inline-touching-normal
3232
- repo: https://github.com/pre-commit/mirrors-mypy
33-
rev: v1.11.1
33+
rev: v1.11.2
3434
hooks:
3535
- id: mypy
3636
files: ^src/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![pypi version](https://img.shields.io/pypi/v/atomate2?color=blue)](https://pypi.org/project/atomate2)
66
![supported python versions](https://img.shields.io/pypi/pyversions/atomate2)
77
[![Zenodo](https://img.shields.io/badge/DOI-10.5281/zenodo.10677081-blue?logo=Zenodo&logoColor=white)](https://zenodo.org/records/10677081)
8+
[![This project supports Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
89

910
[Documentation][docs] | [PyPI][pypi] | [GitHub][github]
1011

@@ -85,7 +86,7 @@ atomate2 workflows can be run using the [FireWorks] software. See the
8586

8687
## Installation
8788

88-
Atomate2 is a Python 3.8+ library and can be installed using pip. Full installation
89+
Atomate2 is a Python 3.10+ library and can be installed using pip. Full installation
8990
and configuration instructions are provided in the [installation tutorial][installation].
9091

9192
## Tutorials

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169

170170
# Example configuration for intersphinx: refer to the Python standard library.
171171
intersphinx_mapping = {
172-
"python": ("https://docs.python.org/3.8", None),
172+
"python": ("https://docs.python.org/3.10", None),
173173
"matplotlib": ("https://matplotlib.org/stable/", None),
174174
"networkx": ("https://networkx.org/documentation/stable/", None),
175175
"jobflow": ("https://materialsproject.github.io/jobflow", None),

docs/user/codes/openmm.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
>>> conda activate atomate2
77

88
# installing atomate2
9-
>>> pip install git+https://github.com/orionarcher/atomate2.git
9+
>>> pip install git+https://github.com/orionarcher/atomate2
1010

1111
# installing classical_md dependencies
1212
>>> conda install -c conda-forge --file .github/classical_md_requirements.txt
@@ -18,7 +18,7 @@ you can clone the repository and install from source.
1818

1919
``` bash
2020
# installing atomate2
21-
>>> git clone https://github.com/orionarcher/atomate2.git
21+
>>> git clone https://github.com/orionarcher/atomate2
2222
>>> cd atomate2
2323
>>> git branch openff
2424
>>> git checkout openff
@@ -33,7 +33,7 @@ you intend to run on GPU, make sure that the tests are passing for CUDA.
3333
>>> python -m openmm.testInstallation
3434
```
3535

36-
# Understanding Atomate2 OpenMM
36+
## Understanding Atomate2 OpenMM
3737

3838
Atomate2 is really just a collection of jobflow workflows relevant to
3939
materials science. In all the workflows, we pass our system of interest
@@ -55,7 +55,6 @@ The first job we need to create generates the `Interchange` object.
5555
To specify the system of interest, we use give it the SMILES strings,
5656
counts, and names (optional) of the molecules we want to include.
5757

58-
5958
```python
6059
from atomate2.openff.core import generate_interchange
6160

@@ -73,7 +72,6 @@ out the `create_mol_spec` function in the `atomate2.openff.utils`
7372
module. Under the hood, this is being called on each mol_spec dict.
7473
Meaning the code below is functionally identical to the code above.
7574

76-
7775
```python
7876
from atomate2.openff.utils import create_mol_spec
7977

@@ -90,7 +88,6 @@ object, which we can pass to the next stage of the simulation.
9088
NOTE: It's actually mandatory to include partial charges
9189
for PF6- here, the built in partial charge method fails.
9290

93-
9491
```python
9592
import numpy as np
9693
from pymatgen.core.structure import Molecule
@@ -205,13 +202,13 @@ Awesome! At this point, we've run a workflow and could start analyzing
205202
our data. Before we get there though, let's go through some of the
206203
other simulation options available.
207204

208-
# Digging Deeper
205+
## Digging Deeper
209206

210207
Atomate2 OpenMM supports running a variety of workflows with different
211208
configurations. Below we dig in to some of the more advanced options.
212209

213-
214210
### Configuring the Simulation
211+
215212
<details>
216213
<summary>Learn more about the configuration of OpenMM simulations</summary>
217214

@@ -228,14 +225,13 @@ once and have it apply to all stages of the simulation. The value inheritance
228225
is as follows: 1) any explicitly set value, 2) the value from the previous
229226
maker, 3) the default value (as shown below).
230227

231-
232228
```python
233229
from atomate2.openmm.jobs.base import OPENMM_MAKER_DEFAULTS
234230

235231
print(OPENMM_MAKER_DEFAULTS)
236232
```
237233

238-
```
234+
```py
239235
{
240236
"step_size": 0.001,
241237
"temperature": 298,
@@ -339,7 +335,6 @@ Rather than use `jobflow.yaml`, you could also create the stores in
339335
Python and pass the stores to the `run_locally` function. This is a bit
340336
more code, so usually the prior method is preferred.
341337

342-
343338
```python
344339
from jobflow import run_locally, JobStore
345340
from maggma.stores import MongoStore, S3Store
@@ -374,19 +369,18 @@ run_locally(
374369
ensure_success=True,
375370
)
376371
```
372+
377373
</details>
378374

379375
### Running on GPUs
380376

381377
<details>
382378
<summary>Learn to accelerate MD simulations with GPUs</summary>
383379

384-
385380
Running on a GPU is nearly as simple as running on a CPU. The only difference
386381
is that you need to specify the `platform_properties` argument in the
387382
`EnergyMinimizationMaker` with the `DeviceIndex` of the GPU you want to use.
388383

389-
390384
```python
391385
production_maker = OpenMMFlowMaker(
392386
name="test_production",
@@ -414,7 +408,6 @@ First you'll need to install mpi4py.
414408

415409
Then you can modify and run the following script to distribute the work across the GPUs.
416410

417-
418411
```python
419412
# other imports
420413
@@ -457,15 +450,16 @@ for i in range(4):
457450
# this script will run four times, each with a different rank, thus distributing the work across the four GPUs.
458451
run_locally(flows[rank], ensure_success=True)
459452
```
453+
460454
</details>
461455

462-
# Analysis with Emmet
456+
## Analysis with Emmet
463457

464458
For now, you'll need to make sure you have a particular emmet branch installed.
465459
Later the builders will be integrated into `main`.
466460

467461
```bash
468-
pip install git+https://github.com/orionarcher/emmet.git@md_builders
462+
pip install git+https://github.com/orionarcher/emmet@md_builders
469463
```
470464

471465
### Analyzing Local Data
@@ -498,6 +492,7 @@ u = create_universe(
498492
499493
solute = create_solute(u, solute_name="Li", networking_solvents=["PF6"])
500494
```
495+
501496
</details>
502497

503498
### Setting up builders
@@ -556,6 +551,7 @@ builder.connect()
556551
<summary>Here are some more convenient queries.</summary>
557552

558553
Here are some more convenient queries we could use!
554+
559555
```python
560556
# query jobs from a specific day
561557
april_16 = {"completed_at": {"$regex": "^2024-04-16"}}
@@ -570,6 +566,7 @@ job_uuids = [
570566
]
571567
my_specific_jobs = {"uuid": {"$in": job_uuids}}
572568
```
569+
573570
</details>
574571

575572
</details>
@@ -611,6 +608,7 @@ solute = create_solute(
611608
fallback_radius=3,
612609
)
613610
```
611+
614612
</details>
615613

616614
### Automated analysis with builders

docs/user/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ atomate2
136136
## Create a conda environment
137137

138138
```{note}
139-
Make sure to create a Python 3.8+ environment as recent versions of atomate2 only
140-
support Python 3.8 and higher.
139+
Make sure to create a Python 3.10+ environment as recent versions of atomate2 only
140+
support Python 3.10 and higher.
141141
```
142142

143143
We highly recommend that you organize your installation of the atomate2 and the other

pyproject.toml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ classifiers = [
1919
"Programming Language :: Python :: 3",
2020
"Programming Language :: Python :: 3.10",
2121
"Programming Language :: Python :: 3.11",
22-
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.12",
2323
"Topic :: Other/Nonlisted Topic",
2424
"Topic :: Scientific/Engineering",
2525
]
26-
requires-python = ">=3.9"
26+
requires-python = ">=3.10"
2727
dependencies = [
2828
"PyYAML",
2929
"click",
@@ -54,21 +54,19 @@ forcefields = [
5454
"calorine<=2.2.1",
5555
"chgnet>=0.2.2",
5656
"mace-torch>=0.3.3",
57-
"torchdata<=0.7.1", # TODO: remove when issue fixed
5857
"matgl>=1.1.3",
59-
"quippy-ase>=0.9.14",
58+
# quippy-ase support for py3.12 tracked in https://github.com/libAtoms/QUIP/issues/645
59+
"quippy-ase>=0.9.14; python_version < '3.12'",
6060
"sevenn>=0.9.3",
61+
"torchdata<=0.7.1", # TODO: remove when issue fixed
6162
]
62-
ase = [
63-
"ase>=3.23.0",
64-
]
65-
ase-ext = [
66-
"tblite>=0.3.0",
67-
]
63+
ase = ["ase>=3.23.0"]
64+
# tblite py3.12 support tracked in https://github.com/tblite/tblite/issues/198
65+
ase-ext = ["tblite>=0.3.0; python_version < '3.12'"]
6866
openmm = [
6967
"mdanalysis>=2.7.0",
70-
"openmm>=8.1.0",
7168
"openmm-mdanalysis-reporter>=0.1.0",
69+
"openmm>=8.1.0",
7270
]
7371
docs = [
7472
"FireWorks==2.0.3",
@@ -101,31 +99,31 @@ strict = [
10199
"ijson==3.3.0",
102100
"jobflow==0.1.18",
103101
"lobsterpy==0.4.5",
102+
"mdanalysis==2.7.0",
104103
"monty==2024.7.30",
105104
"mp-api==0.42.2",
106105
"numpy",
106+
"openmm-mdanalysis-reporter==0.1.0",
107+
"openmm==8.1.1",
107108
"phonopy==2.27.0",
108109
"pydantic-settings==2.5.2",
109110
"pydantic==2.9.2",
110111
"pymatgen-analysis-defects==2024.7.19",
111112
"pymatgen==2024.6.10",
112113
"python-ulid==2.7.0",
113114
"seekpath==2.1.0",
114-
"tblite==0.3.0",
115+
"tblite==0.3.0; python_version < '3.12'",
115116
"typing-extensions==4.12.2",
116-
"mdanalysis==2.7.0",
117-
"openmm==8.1.1",
118-
"openmm-mdanalysis-reporter==0.1.0",
119117
]
120118
strict-forcefields = [
121119
"calorine==2.2.1",
122120
"chgnet==0.3.8",
123121
"mace-torch>=0.3.3",
124-
"torchdata==0.7.1", # TODO: remove when issue fixed
125122
"matgl==1.1.3",
126-
"quippy-ase==0.9.14",
123+
"quippy-ase==0.9.14; python_version < '3.12'",
127124
"sevenn==0.9.3.post1",
128125
"torch==2.2.1",
126+
"torchdata==0.7.1", # TODO: remove when issue fixed
129127
]
130128

131129
[project.scripts]
@@ -179,7 +177,8 @@ exclude_lines = [
179177
]
180178

181179
[tool.ruff]
182-
target-version = "py39"
180+
target-version = "py310"
181+
output-format = "concise"
183182

184183
[tool.ruff.lint]
185184
select = ["ALL"]

src/atomate2/abinit/sets/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
from dataclasses import dataclass, field
1010
from pathlib import Path
11-
from typing import TYPE_CHECKING, Any, Callable
11+
from typing import TYPE_CHECKING, Any
1212

1313
import numpy as np
1414
from abipy.abio.inputs import AbinitInput, MultiDataset
@@ -39,7 +39,7 @@
3939
)
4040

4141
if TYPE_CHECKING:
42-
from collections.abc import Iterable, Sequence
42+
from collections.abc import Callable, Iterable, Sequence
4343

4444
from pymatgen.core.structure import Structure
4545

@@ -394,7 +394,7 @@ def check_format_prev_dirs(
394394
"""Check and format the prev_dirs (restart or dependency)."""
395395
if prev_dirs is None:
396396
return None
397-
if isinstance(prev_dirs, (str, Path)):
397+
if isinstance(prev_dirs, str | Path):
398398
return [str(prev_dirs)]
399399
return [str(prev_dir) for prev_dir in prev_dirs]
400400

src/atomate2/abinit/sets/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass, field
6-
from typing import TYPE_CHECKING, Callable
6+
from typing import TYPE_CHECKING
77

88
import numpy as np
99
from abipy.abio.factories import (
@@ -18,6 +18,8 @@
1818
from atomate2.abinit.sets.base import AbinitInputGenerator
1919

2020
if TYPE_CHECKING:
21+
from collections.abc import Callable
22+
2123
from abipy.abio.inputs import AbinitInput
2224
from pymatgen.core import Structure
2325
from pymatgen.io.abinit import PseudoTable

0 commit comments

Comments
 (0)