Skip to content

Commit e816d01

Browse files
breaking: drop Python 3.9 (#5078)
Python 3.9 has gone to EOL. NumPy, TensorFlow, PyTorch, and JAX have removed Python 3.9 support. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d774ede commit e816d01

File tree

290 files changed

+2061
-3141
lines changed

Some content is hidden

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

290 files changed

+2061
-3141
lines changed

.github/workflows/test_python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
group: [1, 2, 3, 4, 5, 6]
22-
python: ["3.9", "3.12"]
22+
python: ["3.10", "3.12"]
2323

2424
steps:
2525
- uses: actions/checkout@v6
@@ -85,7 +85,7 @@ jobs:
8585
strategy:
8686
fail-fast: false
8787
matrix:
88-
python: ["3.9", "3.12"]
88+
python: ["3.10", "3.12"]
8989
needs: testpython
9090
steps:
9191
- name: Get durations from cache

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ source/ # C++ source code and tests
9494

9595
### Build Dependencies and Setup
9696

97-
- **Python 3.9+** required
97+
- **Python 3.10+** required
9898
- **Virtual environment** strongly recommended: `uv venv venv && source venv/bin/activate`
9999
- **Backend dependencies**: TensorFlow, PyTorch, JAX, or Paddle (install before building)
100100
- **Build tools**: CMake, C++ compiler, scikit-build-core

backend/dynamic_metadata.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from pathlib import (
44
Path,
55
)
6-
from typing import (
7-
Optional,
8-
)
96

107
from .find_pytorch import (
118
get_pt_requirement,
@@ -31,7 +28,7 @@ def __dir__() -> list[str]:
3128

3229
def dynamic_metadata(
3330
field: str,
34-
settings: Optional[dict[str, object]] = None,
31+
settings: dict[str, object] | None = None,
3532
):
3633
assert field in ["optional-dependencies", "entry-points", "scripts"]
3734
_, _, find_libpython_requires, extra_scripts, tf_version, pt_version = (

backend/find_paddle.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@
1717
from sysconfig import (
1818
get_path,
1919
)
20-
from typing import (
21-
Optional,
22-
Union,
23-
)
2420

2521

2622
@lru_cache
27-
def find_paddle() -> tuple[Optional[str], list[str]]:
23+
def find_paddle() -> tuple[str | None, list[str]]:
2824
"""Find PaddlePadle library.
2925
3026
Tries to find PaddlePadle in the order of:
@@ -111,7 +107,7 @@ def get_pd_requirement(pd_version: str = "") -> dict:
111107

112108

113109
@lru_cache
114-
def get_pd_version(pd_path: Optional[Union[str, Path]]) -> str:
110+
def get_pd_version(pd_path: str | Path | None) -> str:
115111
"""Get Paddle version from a Paddle Python library path.
116112
117113
Parameters

backend/find_pytorch.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
from sysconfig import (
1818
get_path,
1919
)
20-
from typing import (
21-
Optional,
22-
Union,
23-
)
2420

2521
from packaging.specifiers import (
2622
SpecifierSet,
@@ -35,7 +31,7 @@
3531

3632

3733
@lru_cache
38-
def find_pytorch() -> tuple[Optional[str], list[str]]:
34+
def find_pytorch() -> tuple[str | None, list[str]]:
3935
"""Find PyTorch library.
4036
4137
Tries to find PyTorch in the order of:
@@ -150,7 +146,7 @@ def get_pt_requirement(pt_version: str = "") -> dict:
150146

151147

152148
@lru_cache
153-
def get_pt_version(pt_path: Optional[Union[str, Path]]) -> str:
149+
def get_pt_version(pt_path: str | Path | None) -> str:
154150
"""Get TF version from a TF Python library path.
155151
156152
Parameters

backend/find_tensorflow.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
from sysconfig import (
1818
get_path,
1919
)
20-
from typing import (
21-
Optional,
22-
Union,
23-
)
2420

2521
from packaging.specifiers import (
2622
SpecifierSet,
@@ -32,7 +28,7 @@
3228

3329

3430
@lru_cache
35-
def find_tensorflow() -> tuple[Optional[str], list[str]]:
31+
def find_tensorflow() -> tuple[str | None, list[str]]:
3632
"""Find TensorFlow library.
3733
3834
Tries to find TensorFlow in the order of:
@@ -208,7 +204,7 @@ def get_tf_requirement(tf_version: str = "") -> dict:
208204

209205

210206
@lru_cache
211-
def get_tf_version(tf_path: Optional[Union[str, Path]]) -> str:
207+
def get_tf_version(tf_path: str | Path | None) -> str:
212208
"""Get TF version from a TF Python library path.
213209
214210
Parameters

deepmd/backend/backend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
from abc import (
33
abstractmethod,
44
)
5+
from collections.abc import (
6+
Callable,
7+
)
58
from enum import (
69
Flag,
710
auto,
811
)
912
from typing import (
1013
TYPE_CHECKING,
11-
Callable,
1214
ClassVar,
1315
)
1416

deepmd/backend/dpmodel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
from collections.abc import (
3+
Callable,
4+
)
25
from typing import (
36
TYPE_CHECKING,
4-
Callable,
57
ClassVar,
68
)
79

deepmd/backend/jax.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
from collections.abc import (
3+
Callable,
4+
)
25
from importlib.util import (
36
find_spec,
47
)
58
from typing import (
69
TYPE_CHECKING,
7-
Callable,
810
ClassVar,
911
)
1012

deepmd/backend/paddle.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
from collections.abc import (
3+
Callable,
4+
)
25
from importlib.util import (
36
find_spec,
47
)
58
from typing import (
69
TYPE_CHECKING,
7-
Callable,
810
ClassVar,
911
)
1012

0 commit comments

Comments
 (0)