From 87b3be94e504fecae2623d734554031a9467e878 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 8 Nov 2023 16:00:00 -0500 Subject: [PATCH 1/2] rename `deepmd_cli` to `deepmd_utils` Signed-off-by: Jinzhe Zeng --- .github/labeler.yml | 2 +- .github/workflows/test_cuda.yml | 2 +- .github/workflows/test_python.yml | 2 +- backend/dynamic_metadata.py | 2 +- codecov.yml | 2 +- deepmd/__init__.py | 2 +- deepmd/entrypoints/main.py | 2 +- {deepmd_cli => deepmd_utils}/__init__.py | 0 {deepmd_cli => deepmd_utils}/main.py | 2 +- doc/conf.py | 3 ++- pyproject.toml | 4 ++-- 11 files changed, 12 insertions(+), 11 deletions(-) rename {deepmd_cli => deepmd_utils}/__init__.py (100%) rename {deepmd_cli => deepmd_utils}/main.py (99%) diff --git a/.github/labeler.yml b/.github/labeler.yml index 195d2cd217..049c9badff 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,6 +1,6 @@ Python: - deepmd/**/* -- deepmd_cli/**/* +- deepmd_utils/**/* - source/tests/**/* Docs: doc/**/* Examples: examples/**/* diff --git a/.github/workflows/test_cuda.yml b/.github/workflows/test_cuda.yml index ca72a32277..5e754226ae 100644 --- a/.github/workflows/test_cuda.yml +++ b/.github/workflows/test_cuda.yml @@ -42,7 +42,7 @@ jobs: DP_VARIANT: cuda CUDA_PATH: /usr/local/cuda-11.8 - run: dp --version - - run: python -m pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0 + - run: python -m pytest -s --cov=deepmd --cov=deepmd_utils source/tests --durations=0 - run: source/install/test_cc_local.sh env: OMP_NUM_THREADS: 1 diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index 0ac29a7d9b..b6011cb523 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -38,7 +38,7 @@ jobs: HOROVOD_WITH_TENSORFLOW: 1 HOROVOD_WITHOUT_GLOO: 1 - run: dp --version - - run: pytest --cov=deepmd --cov=deepmd_cli source/tests --durations=0 + - run: pytest --cov=deepmd --cov=deepmd_utils source/tests --durations=0 - uses: codecov/codecov-action@v3 with: gcov: true diff --git a/backend/dynamic_metadata.py b/backend/dynamic_metadata.py index 59df7dce81..dad9c5b597 100644 --- a/backend/dynamic_metadata.py +++ b/backend/dynamic_metadata.py @@ -27,7 +27,7 @@ def dynamic_metadata( _, _, find_libpython_requires, extra_scripts, tf_version = get_argument_from_env() if field == "scripts": return { - "dp": "deepmd_cli.main:main", + "dp": "deepmd_utils.main:main", **extra_scripts, } elif field == "optional-dependencies": diff --git a/codecov.yml b/codecov.yml index 24dd9e3a23..3654859423 100644 --- a/codecov.yml +++ b/codecov.yml @@ -20,7 +20,7 @@ component_management: name: Python paths: - deepmd/** - - deepmd_cli/** + - deepmd_utils/** - component_id: module_op name: OP paths: diff --git a/deepmd/__init__.py b/deepmd/__init__.py index b02817b6fc..0190bbc124 100644 --- a/deepmd/__init__.py +++ b/deepmd/__init__.py @@ -32,7 +32,7 @@ set_mkl() try: - from deepmd_cli._version import version as __version__ + from deepmd_utils._version import version as __version__ except ImportError: from .__about__ import ( __version__, diff --git a/deepmd/entrypoints/main.py b/deepmd/entrypoints/main.py index 782136b542..2c6ac26a7f 100644 --- a/deepmd/entrypoints/main.py +++ b/deepmd/entrypoints/main.py @@ -32,7 +32,7 @@ from deepmd.nvnmd.entrypoints.train import ( train_nvnmd, ) -from deepmd_cli.main import ( +from deepmd_utils.main import ( get_ll, main_parser, parse_args, diff --git a/deepmd_cli/__init__.py b/deepmd_utils/__init__.py similarity index 100% rename from deepmd_cli/__init__.py rename to deepmd_utils/__init__.py diff --git a/deepmd_cli/main.py b/deepmd_utils/main.py similarity index 99% rename from deepmd_cli/main.py rename to deepmd_utils/main.py index bffc1c6911..f2887d6f6e 100644 --- a/deepmd_cli/main.py +++ b/deepmd_utils/main.py @@ -8,7 +8,7 @@ ) try: - from deepmd_cli._version import version as __version__ + from deepmd_utils._version import version as __version__ except ImportError: __version__ = "unknown" diff --git a/doc/conf.py b/doc/conf.py index b17ca82fda..63af974a86 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -134,7 +134,7 @@ def run_apidoc(_): sys.path.append(os.path.join(os.path.dirname(__file__), "..")) cur_dir = os.path.abspath(os.path.dirname(__file__)) - module = os.path.join(cur_dir, "..", "deepmd") + module = os.path.join(cur_dir, "..") main( [ "-M", @@ -145,6 +145,7 @@ def run_apidoc(_): "-o", os.path.join(cur_dir, "api_py"), module, + "source/*", "--force", ] ) diff --git a/pyproject.toml b/pyproject.toml index f8bfbbee79..4ba3bb81e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,7 @@ sdist.exclude = [ ] wheel.packages = [ "deepmd", - "deepmd_cli", + "deepmd_utils", ] wheel.py-api = "py37" build-dir = "build/{wheel_tag}" @@ -102,7 +102,7 @@ provider-path = "backend" provider = "scikit_build_core.metadata.fancy_pypi_readme" [[tool.scikit-build.generate]] -path = "deepmd_cli/_version.py" +path = "deepmd_utils/_version.py" template = ''' version = "${version}" ''' From 85af19a621a4b01dadfa11b3a14b2dd3ed79666c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 8 Nov 2023 16:27:39 -0500 Subject: [PATCH 2/2] update documentation Signed-off-by: Jinzhe Zeng --- deepmd_utils/__init__.py | 6 +++--- deepmd_utils/main.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deepmd_utils/__init__.py b/deepmd_utils/__init__.py index d295053965..1c5314bb7e 100644 --- a/deepmd_utils/__init__.py +++ b/deepmd_utils/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later -"""This module contains the entry points for DeePMD-kit. +"""Untilization methods for DeePMD-kit. -If only printing the help message, this module does not call -the main DeePMD-kit module to avoid the slow import of TensorFlow. +The __init__ module should not import any modules +for performance. """ diff --git a/deepmd_utils/main.py b/deepmd_utils/main.py index f2887d6f6e..3dc54db052 100644 --- a/deepmd_utils/main.py +++ b/deepmd_utils/main.py @@ -1,4 +1,9 @@ # SPDX-License-Identifier: LGPL-3.0-or-later +"""The entry points for DeePMD-kit. + +If only printing the help message, this module does not call +the main DeePMD-kit module to avoid the slow import of TensorFlow. +""" import argparse import logging import textwrap