Skip to content

Commit

Permalink
breaking: drop Python 3.7 support (#3185)
Browse files Browse the repository at this point in the history
... per discussion.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored Jan 27, 2024
1 parent f900f3a commit 2631ce2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 22 deletions.
6 changes: 3 additions & 3 deletions backend/find_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)


@lru_cache()
@lru_cache
def find_tensorflow() -> Tuple[Optional[str], List[str]]:
"""Find TensorFlow library.
Expand Down Expand Up @@ -111,7 +111,7 @@ def find_tensorflow() -> Tuple[Optional[str], List[str]]:
return tf_install_dir, requires


@lru_cache()
@lru_cache
def get_tf_requirement(tf_version: str = "") -> dict:
"""Get TensorFlow requirement (CPU) when TF is not installed.
Expand Down Expand Up @@ -189,7 +189,7 @@ def get_tf_requirement(tf_version: str = "") -> dict:
}


@lru_cache()
@lru_cache
def get_tf_version(tf_path: Union[str, Path]) -> str:
"""Get TF version from a TF Python library path.
Expand Down
2 changes: 1 addition & 1 deletion backend/read_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)


@lru_cache()
@lru_cache
def get_argument_from_env() -> Tuple[str, list, list, dict, str]:
"""Get the arguments from environment variables.
Expand Down
4 changes: 2 additions & 2 deletions deepmd/tf/utils/tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,12 @@ def _get_layer_size(self):
return layer_size

@property
@lru_cache()
@lru_cache
def _n_all_excluded(self) -> int:
"""Then number of types excluding all types."""
return sum(int(self._all_excluded(ii)) for ii in range(0, self.ntypes))

@lru_cache()
@lru_cache
def _all_excluded(self, ii: int) -> bool:
"""Check if type ii excluds all types.
Expand Down
2 changes: 1 addition & 1 deletion doc/development/coding-conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Rules
-----

The code must be compatible with the oldest supported version of python
which is 3.7
which is 3.8.

The project follows the generic coding conventions as
specified in the `Style Guide for Python Code`_, `Docstring
Expand Down
4 changes: 4 additions & 0 deletions doc/install/easy-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ After your easy installation, DeePMD-kit (`dp`) and LAMMPS (`lmp`) will be avail
Note: The off-line packages and conda packages require the [GNU C Library](https://www.gnu.org/software/libc/) 2.17 or above. The GPU version requires [compatible NVIDIA driver](https://docs.nvidia.com/deploy/cuda-compatibility/index.html#minor-version-compatibility) to be installed in advance. It is possible to force conda to [override detection](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-virtual.html#overriding-detected-packages) when installation, but these requirements are still necessary during runtime.
:::

:::{note}
Python 3.8 or above is required for Python interface.
:::

- [Install off-line packages](#install-off-line-packages)
- [Install with conda](#install-with-conda)
- [Install with docker](#install-with-docker)
Expand Down
5 changes: 3 additions & 2 deletions doc/install/install-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ deepmd_source_dir=`pwd`

## Install the python interface
### Install Tensorflow's python interface
First, check the python version on your machine
First, check the python version on your machine.
Python 3.8 or above is required.
```bash
python --version
```

We follow the virtual environment approach to install TensorFlow's Python interface. The full instruction can be found on the official [TensorFlow website](https://www.tensorflow.org/install/pip). TensorFlow 1.8 or later is supported. Now we assume that the Python interface will be installed to the virtual environment directory `$tensorflow_venv`
We follow the virtual environment approach to install TensorFlow's Python interface. The full instruction can be found on the official [TensorFlow website](https://www.tensorflow.org/install/pip). TensorFlow 2.2 or later is supported. Now we assume that the Python interface will be installed to the virtual environment directory `$tensorflow_venv`
```bash
virtualenv -p python3 $tensorflow_venv
source $tensorflow_venv/bin/activate
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Environment :: GPU :: NVIDIA CUDA :: 12 :: 12.2",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Physics",
Expand All @@ -46,7 +46,7 @@ dependencies = [
'wcmatch',
'packaging',
]
requires-python = ">=3.7"
requires-python = ">=3.8"
keywords = ["deepmd"]

[project.entry-points."lammps.plugins"]
Expand Down
22 changes: 11 additions & 11 deletions source/install/build_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ def __init__(self, version="1.11.0") -> None:
self.version = version

@property
@lru_cache()
@lru_cache
def resources(self) -> Dict[str, OnlineResource]:
return {
"bazelisk": RESOURCES["bazelisk-" + self.version],
}

@property
@lru_cache()
@lru_cache
def dependencies(self) -> Dict[str, Build]:
return {}

Expand All @@ -449,12 +449,12 @@ class BuildNumpy(Build):
"""Build NumPy."""

@property
@lru_cache()
@lru_cache
def resources(self) -> Dict[str, OnlineResource]:
return {}

@property
@lru_cache()
@lru_cache
def dependencies(self) -> Dict[str, Build]:
return {}

Expand All @@ -481,12 +481,12 @@ class BuildCUDA(Build):
"""Find CUDA."""

@property
@lru_cache()
@lru_cache
def resources(self) -> Dict[str, OnlineResource]:
return {}

@property
@lru_cache()
@lru_cache
def dependencies(self) -> Dict[str, Build]:
return {}

Expand Down Expand Up @@ -536,7 +536,7 @@ def cudnn_version(self):
)

@property
@lru_cache()
@lru_cache
def cuda_compute_capabilities(self):
"""Get cuda compute capabilities."""
cuda_version = tuple(map(int, self.cuda_version.split(".")))
Expand All @@ -554,12 +554,12 @@ class BuildROCM(Build):
"""Find ROCm."""

@property
@lru_cache()
@lru_cache
def resources(self) -> Dict[str, OnlineResource]:
return {}

@property
@lru_cache()
@lru_cache
def dependencies(self) -> Dict[str, Build]:
return {}

Expand Down Expand Up @@ -599,14 +599,14 @@ def __init__(
self.enable_rocm = enable_rocm

@property
@lru_cache()
@lru_cache
def resources(self) -> Dict[str, OnlineResource]:
return {
"tensorflow": RESOURCES["tensorflow-" + self.version],
}

@property
@lru_cache()
@lru_cache
def dependencies(self) -> Dict[str, Build]:
optional_dep = {}
if self.enable_cuda:
Expand Down

0 comments on commit 2631ce2

Please sign in to comment.