From a9fc91f7f06a9e70b07457a2b650e86db6ab9809 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Mon, 23 Mar 2026 12:12:12 +0800 Subject: [PATCH 1/5] chore: drop Python 3.8/3.9 support, bump minimum to 3.10 Python 3.8 reached EOL in October 2024 and 3.9 in October 2025. The lmdb package is also broken on Python 3.8 CI runners. Update classifiers, requires-python, CI matrix, docs, and remove legacy Python <3.8 fallbacks. --- .github/workflows/test.yml | 2 +- README.md | 2 +- docs/installation.md | 2 +- dpdata/plugins/__init__.py | 6 +----- pyproject.toml | 11 ++++------- tests/plugin/pyproject.toml | 2 +- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdb20593c..d5a544692 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: ["3.8", "3.12"] + python-version: ["3.10", "3.13"] steps: - uses: actions/checkout@v6 diff --git a/README.md b/README.md index fdf5f455e..3988a9ecc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you use this software, please cite the following paper: ## Installation -dpdata only supports Python 3.8 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata: +dpdata only supports Python 3.10 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata: - Install via pip: `pip install dpdata` - Install via conda: `conda install -c conda-forge dpdata` diff --git a/docs/installation.md b/docs/installation.md index 1b24e0051..603f0aa4e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,6 +1,6 @@ # Installation -dpdata only supports Python 3.8 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata: +dpdata only supports Python 3.10 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata: - Install via pip: `pip install dpdata` - Install via conda: `conda install -c conda-forge dpdata` diff --git a/dpdata/plugins/__init__.py b/dpdata/plugins/__init__.py index 15634bc0a..d04873e03 100644 --- a/dpdata/plugins/__init__.py +++ b/dpdata/plugins/__init__.py @@ -1,13 +1,9 @@ from __future__ import annotations import importlib +from importlib import metadata from pathlib import Path -try: - from importlib import metadata -except ImportError: # for Python<3.8 - import importlib_metadata as metadata - PACKAGE_BASE = "dpdata.plugins" NOT_LOADABLE = ("__init__.py",) diff --git a/pyproject.toml b/pyproject.toml index 683001bb9..67d20bf6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,10 +12,10 @@ authors = [ ] license = {file = "LICENSE"} classifiers = [ - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", ] dependencies = [ @@ -26,10 +26,8 @@ dependencies = [ 'wcmatch', 'lmdb', 'msgpack-numpy', - 'importlib_metadata>=1.4; python_version < "3.8"', - 'typing_extensions; python_version < "3.8"', ] -requires-python = ">=3.8" +requires-python = ">=3.10" readme = "README.md" keywords = ["lammps", "vasp", "deepmd-kit"] @@ -46,8 +44,7 @@ test = [ ] ase = ['ase'] amber = [ - 'parmed; python_version >= "3.8"', - 'parmed<4; python_version < "3.8"', + 'parmed', ] pymatgen = ['pymatgen'] docs = [ diff --git a/tests/plugin/pyproject.toml b/tests/plugin/pyproject.toml index 3e01f27cb..ddbbadaf8 100644 --- a/tests/plugin/pyproject.toml +++ b/tests/plugin/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ 'dpdata', ] readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.10" [project.entry-points.'dpdata.plugins'] random = "dpdata_plugin_test:ep" From 13ac005dc740813e7cf0360ce538ce2408f33b70 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 04:13:14 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpdata/driver.py | 3 ++- dpdata/plugins/ase.py | 3 ++- dpdata/system.py | 2 +- dpdata/utils.py | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dpdata/driver.py b/dpdata/driver.py index b63c417af..c3e3c8325 100644 --- a/dpdata/driver.py +++ b/dpdata/driver.py @@ -3,7 +3,8 @@ from __future__ import annotations from abc import ABC, abstractmethod -from typing import TYPE_CHECKING, Callable +from collections.abc import Callable +from typing import TYPE_CHECKING from .plugin import Plugin diff --git a/dpdata/plugins/ase.py b/dpdata/plugins/ase.py index a682569c0..4585fa6b3 100644 --- a/dpdata/plugins/ase.py +++ b/dpdata/plugins/ase.py @@ -1,7 +1,8 @@ from __future__ import annotations import os -from typing import TYPE_CHECKING, Generator +from collections.abc import Generator +from typing import TYPE_CHECKING import numpy as np diff --git a/dpdata/system.py b/dpdata/system.py index 64cacf243..75ea7e235 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -6,11 +6,11 @@ import numbers import os import warnings +from collections.abc import Iterable from copy import deepcopy from typing import ( TYPE_CHECKING, Any, - Iterable, Literal, overload, ) diff --git a/dpdata/utils.py b/dpdata/utils.py index 58a908cc7..586a30a10 100644 --- a/dpdata/utils.py +++ b/dpdata/utils.py @@ -2,8 +2,9 @@ import io import os +from collections.abc import Generator from contextlib import contextmanager -from typing import TYPE_CHECKING, Generator, Literal, overload +from typing import TYPE_CHECKING, Literal, overload import numpy as np From 28b78015a0ecaba9ca32931c4e098401fb0f90f3 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Mon, 23 Mar 2026 12:35:01 +0800 Subject: [PATCH 3/5] chore: bump Python version in test_import and pub-pypi workflows to 3.10 --- .github/workflows/pub-pypi.yml | 4 ++-- .github/workflows/test_import.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pub-pypi.yml b/.github/workflows/pub-pypi.yml index 24f99f7f9..dea82b7e9 100644 --- a/.github/workflows/pub-pypi.yml +++ b/.github/workflows/pub-pypi.yml @@ -10,10 +10,10 @@ jobs: steps: - uses: actions/checkout@master - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@master with: - python-version: 3.9 + python-version: "3.10" - name: Install pypa/build run: >- diff --git a/.github/workflows/test_import.yml b/.github/workflows/test_import.yml index 178f1c9e7..0b629b926 100644 --- a/.github/workflows/test_import.yml +++ b/.github/workflows/test_import.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: - python-version: '3.9' + python-version: '3.10' architecture: 'x64' - run: python -m pip install uv - run: python -m uv pip install --system . From ad772c2d6f0a0fcf074227883557a6e7c4259245 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 23 Mar 2026 14:51:25 +0800 Subject: [PATCH 4/5] run pre-commit --- dpdata/driver.py | 3 ++- dpdata/plugins/ase.py | 3 ++- dpdata/system.py | 3 ++- dpdata/utils.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dpdata/driver.py b/dpdata/driver.py index c3e3c8325..130bd78b4 100644 --- a/dpdata/driver.py +++ b/dpdata/driver.py @@ -3,12 +3,13 @@ from __future__ import annotations from abc import ABC, abstractmethod -from collections.abc import Callable from typing import TYPE_CHECKING from .plugin import Plugin if TYPE_CHECKING: + from collections.abc import Callable + import ase.calculators.calculator diff --git a/dpdata/plugins/ase.py b/dpdata/plugins/ase.py index 4585fa6b3..495c4a7ea 100644 --- a/dpdata/plugins/ase.py +++ b/dpdata/plugins/ase.py @@ -1,7 +1,6 @@ from __future__ import annotations import os -from collections.abc import Generator from typing import TYPE_CHECKING import numpy as np @@ -11,6 +10,8 @@ from dpdata.format import Format if TYPE_CHECKING: + from collections.abc import Generator + import ase from ase.optimize.optimize import Optimizer diff --git a/dpdata/system.py b/dpdata/system.py index 75ea7e235..6023891ff 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -6,7 +6,6 @@ import numbers import os import warnings -from collections.abc import Iterable from copy import deepcopy from typing import ( TYPE_CHECKING, @@ -37,6 +36,8 @@ ) if TYPE_CHECKING: + from collections.abc import Iterable + import parmed diff --git a/dpdata/utils.py b/dpdata/utils.py index 586a30a10..0ea39e70f 100644 --- a/dpdata/utils.py +++ b/dpdata/utils.py @@ -2,7 +2,6 @@ import io import os -from collections.abc import Generator from contextlib import contextmanager from typing import TYPE_CHECKING, Literal, overload @@ -131,6 +130,7 @@ def utf8len(s: str) -> int: if TYPE_CHECKING: + from collections.abc import Generator FileType = io.IOBase | str | os.PathLike From ee3221a2d66bb623ce55d9caefe83dc662bc2c97 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 06:51:40 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpdata/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpdata/utils.py b/dpdata/utils.py index 0ea39e70f..c81d67104 100644 --- a/dpdata/utils.py +++ b/dpdata/utils.py @@ -131,6 +131,7 @@ def utf8len(s: str) -> int: if TYPE_CHECKING: from collections.abc import Generator + FileType = io.IOBase | str | os.PathLike