Skip to content

Commit

Permalink
rename deepmd_cli to deepmd_utils (#2983)
Browse files Browse the repository at this point in the history
Preparation for more methods in the `deepmd_utils` package.
(`deepmd_cli` is not a good name for this usage)

Enable documentation for the `deepmd_utils` package.

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Nov 9, 2023
1 parent 283e8fe commit 43fc073
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Python:
- deepmd/**/*
- deepmd_cli/**/*
- deepmd_utils/**/*
- source/tests/**/*
Docs: doc/**/*
Examples: examples/**/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion backend/dynamic_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ component_management:
name: Python
paths:
- deepmd/**
- deepmd_cli/**
- deepmd_utils/**
- component_id: module_op
name: OP
paths:
Expand Down
2 changes: 1 addition & 1 deletion deepmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions deepmd_cli/__init__.py

This file was deleted.

6 changes: 6 additions & 0 deletions deepmd_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Untilization methods for DeePMD-kit.
The __init__ module should not import any modules
for performance.
"""
7 changes: 6 additions & 1 deletion deepmd_cli/main.py → deepmd_utils/main.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,7 +13,7 @@
)

try:
from deepmd_cli._version import version as __version__
from deepmd_utils._version import version as __version__
except ImportError:
__version__ = "unknown"

Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -145,6 +145,7 @@ def run_apidoc(_):
"-o",
os.path.join(cur_dir, "api_py"),
module,
"source/*",
"--force",
]
)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sdist.exclude = [
]
wheel.packages = [
"deepmd",
"deepmd_cli",
"deepmd_utils",
]
wheel.py-api = "py37"
build-dir = "build/{wheel_tag}"
Expand All @@ -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}"
'''
Expand Down

0 comments on commit 43fc073

Please sign in to comment.