Skip to content

Commit

Permalink
breaking: drop python 3.7 (#783)
Browse files Browse the repository at this point in the history
<!-- 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>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent 4e5ab18 commit 961b591
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.12"]
python-version: ["3.8", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installation

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:
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:

- Install via pip: `pip install dpdata`
- Install via conda: `conda install -c conda-forge dpdata`
Expand Down
7 changes: 1 addition & 6 deletions docs/make_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

import csv
import os
import sys
from collections import defaultdict
from inspect import Parameter, Signature, cleandoc, signature

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing import Literal

from numpydoc.docscrape import Parameter as numpydoc_Parameter
from numpydoc.docscrape_sphinx import SphinxDocString
Expand Down
8 changes: 4 additions & 4 deletions dpdata/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ class Errors(ErrorsBase):
SYSTEM_TYPE = LabeledSystem

@property
@lru_cache()
@lru_cache
def e_errors(self) -> np.ndarray:
"""Energy errors."""
assert isinstance(self.system_1, self.SYSTEM_TYPE)
assert isinstance(self.system_2, self.SYSTEM_TYPE)
return self.system_1["energies"] - self.system_2["energies"]

@property
@lru_cache()
@lru_cache
def f_errors(self) -> np.ndarray:
"""Force errors."""
assert isinstance(self.system_1, self.SYSTEM_TYPE)
Expand Down Expand Up @@ -153,7 +153,7 @@ class MultiErrors(ErrorsBase):
SYSTEM_TYPE = MultiSystems

@property
@lru_cache()
@lru_cache
def e_errors(self) -> np.ndarray:
"""Energy errors."""
assert isinstance(self.system_1, self.SYSTEM_TYPE)
Expand All @@ -166,7 +166,7 @@ def e_errors(self) -> np.ndarray:
return np.concatenate(errors)

@property
@lru_cache()
@lru_cache
def f_errors(self) -> np.ndarray:
"""Force errors."""
assert isinstance(self.system_1, self.SYSTEM_TYPE)
Expand Down
7 changes: 1 addition & 6 deletions dpdata/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@
import hashlib
import numbers
import os
import sys
import warnings
from copy import deepcopy
from typing import (
TYPE_CHECKING,
Any,
Iterable,
Literal,
overload,
)

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

import numpy as np

import dpdata
Expand Down
7 changes: 1 addition & 6 deletions dpdata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

import io
import os
import sys
from contextlib import contextmanager
from typing import TYPE_CHECKING, Generator, overload
from typing import TYPE_CHECKING, Generator, Literal, overload

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
import numpy as np

from dpdata.periodic_table import Element
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ authors = [
]
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -28,7 +27,7 @@ dependencies = [
'importlib_metadata>=1.4; python_version < "3.8"',
'typing_extensions; python_version < "3.8"',
]
requires-python = ">=3.7"
requires-python = ">=3.8"
readme = "README.md"
keywords = ["lammps", "vasp", "deepmd-kit"]

Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies = [
'dpdata',
]
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"

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

0 comments on commit 961b591

Please sign in to comment.