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.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/.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 . 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/driver.py b/dpdata/driver.py index b63c417af..130bd78b4 100644 --- a/dpdata/driver.py +++ b/dpdata/driver.py @@ -3,11 +3,13 @@ from __future__ import annotations from abc import ABC, abstractmethod -from typing import TYPE_CHECKING, 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/__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/dpdata/plugins/ase.py b/dpdata/plugins/ase.py index a682569c0..495c4a7ea 100644 --- a/dpdata/plugins/ase.py +++ b/dpdata/plugins/ase.py @@ -1,7 +1,7 @@ from __future__ import annotations import os -from typing import TYPE_CHECKING, Generator +from typing import TYPE_CHECKING import numpy as np @@ -10,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 64cacf243..6023891ff 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -10,7 +10,6 @@ from typing import ( TYPE_CHECKING, Any, - Iterable, Literal, overload, ) @@ -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 58a908cc7..c81d67104 100644 --- a/dpdata/utils.py +++ b/dpdata/utils.py @@ -3,7 +3,7 @@ import io import os from contextlib import contextmanager -from typing import TYPE_CHECKING, Generator, Literal, overload +from typing import TYPE_CHECKING, Literal, overload import numpy as np @@ -130,6 +130,8 @@ def utf8len(s: str) -> int: if TYPE_CHECKING: + from collections.abc import Generator + FileType = io.IOBase | str | os.PathLike 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"