Skip to content

Commit 961b591

Browse files
wanghan-iapcmHan Wangpre-commit-ci[bot]
authored
breaking: drop python 3.7 (#783)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **Python Version Support** - Dropped support for Python 3.7 - Now requires Python 3.8 or higher - **Documentation** - Updated installation instructions to reflect new Python version requirements - **Code Maintenance** - Simplified type imports and version-specific code handling - Removed legacy version compatibility checks - **Build Configuration** - Updated GitHub Actions workflow to test only Python 3.8 and 3.12 <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Han Wang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4e5ab18 commit 961b591

File tree

8 files changed

+11
-27
lines changed

8 files changed

+11
-27
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-22.04
1010
strategy:
1111
matrix:
12-
python-version: ["3.7", "3.8", "3.12"]
12+
python-version: ["3.8", "3.12"]
1313

1414
steps:
1515
- uses: actions/checkout@v4

docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation
22

3-
DP-GEN only supports Python 3.7 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 DP-GEN:
3+
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:
44

55
- Install via pip: `pip install dpdata`
66
- Install via conda: `conda install -c conda-forge dpdata`

docs/make_format.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
import csv
44
import os
5-
import sys
65
from collections import defaultdict
76
from inspect import Parameter, Signature, cleandoc, signature
8-
9-
if sys.version_info >= (3, 8):
10-
from typing import Literal
11-
else:
12-
from typing_extensions import Literal
7+
from typing import Literal
138

149
from numpydoc.docscrape import Parameter as numpydoc_Parameter
1510
from numpydoc.docscrape_sphinx import SphinxDocString

dpdata/stat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ class Errors(ErrorsBase):
116116
SYSTEM_TYPE = LabeledSystem
117117

118118
@property
119-
@lru_cache()
119+
@lru_cache
120120
def e_errors(self) -> np.ndarray:
121121
"""Energy errors."""
122122
assert isinstance(self.system_1, self.SYSTEM_TYPE)
123123
assert isinstance(self.system_2, self.SYSTEM_TYPE)
124124
return self.system_1["energies"] - self.system_2["energies"]
125125

126126
@property
127-
@lru_cache()
127+
@lru_cache
128128
def f_errors(self) -> np.ndarray:
129129
"""Force errors."""
130130
assert isinstance(self.system_1, self.SYSTEM_TYPE)
@@ -153,7 +153,7 @@ class MultiErrors(ErrorsBase):
153153
SYSTEM_TYPE = MultiSystems
154154

155155
@property
156-
@lru_cache()
156+
@lru_cache
157157
def e_errors(self) -> np.ndarray:
158158
"""Energy errors."""
159159
assert isinstance(self.system_1, self.SYSTEM_TYPE)
@@ -166,7 +166,7 @@ def e_errors(self) -> np.ndarray:
166166
return np.concatenate(errors)
167167

168168
@property
169-
@lru_cache()
169+
@lru_cache
170170
def f_errors(self) -> np.ndarray:
171171
"""Force errors."""
172172
assert isinstance(self.system_1, self.SYSTEM_TYPE)

dpdata/system.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,16 @@
55
import hashlib
66
import numbers
77
import os
8-
import sys
98
import warnings
109
from copy import deepcopy
1110
from typing import (
1211
TYPE_CHECKING,
1312
Any,
1413
Iterable,
14+
Literal,
1515
overload,
1616
)
1717

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal
20-
else:
21-
from typing_extensions import Literal
22-
2318
import numpy as np
2419

2520
import dpdata

dpdata/utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
import io
44
import os
5-
import sys
65
from contextlib import contextmanager
7-
from typing import TYPE_CHECKING, Generator, overload
6+
from typing import TYPE_CHECKING, Generator, Literal, overload
87

9-
if sys.version_info >= (3, 8):
10-
from typing import Literal
11-
else:
12-
from typing_extensions import Literal
138
import numpy as np
149

1510
from dpdata.periodic_table import Element

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ authors = [
1212
]
1313
license = {file = "LICENSE"}
1414
classifiers = [
15-
"Programming Language :: Python :: 3.7",
1615
"Programming Language :: Python :: 3.8",
1716
"Programming Language :: Python :: 3.9",
1817
"Programming Language :: Python :: 3.10",
@@ -28,7 +27,7 @@ dependencies = [
2827
'importlib_metadata>=1.4; python_version < "3.8"',
2928
'typing_extensions; python_version < "3.8"',
3029
]
31-
requires-python = ">=3.7"
30+
requires-python = ">=3.8"
3231
readme = "README.md"
3332
keywords = ["lammps", "vasp", "deepmd-kit"]
3433

tests/plugin/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies = [
1111
'dpdata',
1212
]
1313
readme = "README.md"
14-
requires-python = ">=3.7"
14+
requires-python = ">=3.8"
1515

1616
[project.entry-points.'dpdata.plugins']
1717
random = "dpdata_plugin_test:ep"

0 commit comments

Comments
 (0)