Skip to content

breaking: move deepmd_utils to deepmd #3178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Python:
- changed-files:
- any-glob-to-any-file:
- deepmd/**/*
- deepmd_utils/**/*
- source/tests/**/*
Docs:
- changed-files:
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 @@ -43,7 +43,7 @@ jobs:
DP_VARIANT: cuda
CUDA_PATH: /usr/local/cuda-12.2
- run: dp --version
- run: python -m pytest -s --cov=deepmd --cov=deepmd_utils source/tests --durations=0
- run: python -m pytest -s --cov=deepmd 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_utils source/tests --durations=0
- run: pytest --cov=deepmd 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_utils.main:main",
"dp": "deepmd.main:main",
**extra_scripts,
}
elif field == "optional-dependencies":
Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ component_management:
name: Python
paths:
- deepmd/**
- deepmd_utils/**
- component_id: module_op
name: OP
paths:
Expand Down
10 changes: 9 additions & 1 deletion deepmd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""DeePMD-kit is a package written in Python/C++, designed to
minimize the effort required to build deep learning-based model
of interatomic potential energy and force field and to perform
molecular dynamics (MD).

The top module (deepmd.__init__) should not import any third-party
modules for performance.
"""
try:
from deepmd_utils._version import version as __version__
from deepmd._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
Expand Down
9 changes: 9 additions & 0 deletions deepmd/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Package dp entry point."""

from deepmd.main import (
main,
)

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion deepmd_utils/calculator.py → deepmd/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
all_changes,
)

from deepmd_utils.infer import (
from deepmd.infer import (
DeepPot,
)

Expand Down
4 changes: 2 additions & 2 deletions deepmd_utils/common.py → deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import numpy as np
import yaml

from deepmd_utils.env import (
from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
)
from deepmd_utils.utils.path import (
from deepmd.utils.path import (
DPPath,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd_utils/driver.py → deepmd/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DPDriver(dpdata.driver.Driver):
"""

def __init__(self, dp: str) -> None:
from deepmd_utils.infer.deep_pot import (
from deepmd.infer.deep_pot import (
DeepPot,
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Module that prints train input arguments docstrings."""

from deepmd_utils.utils.argcheck import (
from deepmd.utils.argcheck import (
gen_doc,
gen_json,
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import numpy as np

from deepmd_utils.utils.batch_size import (
from deepmd.utils.batch_size import (
AutoBatchSize,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

import numpy as np

from deepmd_utils.common import (
from deepmd.common import (
expand_sys_str,
)
from deepmd_utils.infer.deep_pot import (
from deepmd.infer.deep_pot import (
DeepPot,
)
from deepmd_utils.utils.data import (
from deepmd.utils.data import (
DeepmdData,
)

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion deepmd_utils/main.py → deepmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)

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

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import numpy as np

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

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

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
set_mkl()

try:
from deepmd_utils._version import version as __version__
from deepmd._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/calculator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd_utils.calculator import (
from deepmd.calculator import (
DP,
)

Expand Down
16 changes: 8 additions & 8 deletions deepmd/tf/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
tensor_util,
)

from deepmd.tf.env import (
GLOBAL_TF_FLOAT_PRECISION,
op_module,
tf,
)
from deepmd_utils.common import (
from deepmd.common import (
add_data_requirement,
data_requirement,
expand_sys_str,
Expand All @@ -32,15 +27,20 @@
make_default_mesh,
select_idx_map,
)
from deepmd.tf.env import (
GLOBAL_TF_FLOAT_PRECISION,
op_module,
tf,
)

if TYPE_CHECKING:
from deepmd_utils.common import (
from deepmd.common import (
_ACTIVATION,
_PRECISION,
)

__all__ = [
# from deepmd_utils.common
# from deepmd.common
"data_requirement",
"add_data_requirement",
"select_idx_map",
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/entrypoints/doc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd_utils.entrypoints.doc import (
from deepmd.entrypoints.doc import (
doc_train_input,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/entrypoints/gui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd_utils.entrypoints.gui import (
from deepmd.entrypoints.gui import (
start_dpgui,
)

Expand Down
10 changes: 5 additions & 5 deletions deepmd/tf/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
Union,
)

from deepmd.main import (
get_ll,
main_parser,
parse_args,
)
Comment on lines +14 to +18

Check notice

Code scanning / CodeQL

Cyclic import

Import of module [deepmd.main](1) begins an import cycle.
from deepmd.tf.common import (
clear_session,
)
Expand All @@ -32,11 +37,6 @@
from deepmd.tf.nvnmd.entrypoints.train import (
train_nvnmd,
)
from deepmd_utils.main import (
get_ll,
main_parser,
parse_args,
)

__all__ = ["main", "parse_args", "get_ll", "main_parser"]

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)

import deepmd.lib
from deepmd_utils.env import (
from deepmd.env import (
GLOBAL_ENER_FLOAT_PRECISION,
GLOBAL_NP_FLOAT_PRECISION,
global_float_prec,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/infer/deep_pot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import numpy as np

from deepmd.infer.deep_pot import DeepPot as DeepPotBase

Check notice

Code scanning / CodeQL

Cyclic import

Import of module [deepmd.infer.deep_pot](1) begins an import cycle.
from deepmd.tf.common import (
make_default_mesh,
)
Expand All @@ -26,7 +27,6 @@
from deepmd.tf.utils.sess import (
run_sess,
)
from deepmd_utils.infer.deep_pot import DeepPot as DeepPotBase

if TYPE_CHECKING:
from pathlib import (
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/infer/model_devi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd_utils.infer.model_devi import (
from deepmd.infer.model_devi import (
calc_model_devi,
calc_model_devi_e,
calc_model_devi_f,
Expand Down
4 changes: 2 additions & 2 deletions deepmd/tf/loggers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias of deepmd_utils.loggers for backward compatibility."""
"""Alias of deepmd.loggers for backward compatibility."""

from deepmd_utils.loggers.loggers import (
from deepmd.loggers.loggers import (
set_log_handles,
)

Expand Down
4 changes: 2 additions & 2 deletions deepmd/tf/loggers/loggers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias of deepmd_utils.loggers.loggers for backward compatibility."""
from deepmd_utils.loggers.loggers import (
"""Alias of deepmd.loggers.loggers for backward compatibility."""
from deepmd.loggers.loggers import (
set_log_handles,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/model/model_stat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.model_stat import (
from deepmd.utils.model_stat import (
_make_all_stat_ref,
make_stat_input,
merge_sys_stat,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/nvnmd/utils/argcheck.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.argcheck_nvnmd import (
from deepmd.utils.argcheck_nvnmd import (
nvnmd_args,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/argcheck.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.argcheck import (
from deepmd.utils.argcheck import (
gen_args,
gen_doc,
gen_json,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/batch_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from deepmd.tf.utils.errors import (
OutOfMemoryError,
)
from deepmd_utils.utils.batch_size import AutoBatchSize as AutoBatchSizeBase
from deepmd.utils.batch_size import AutoBatchSize as AutoBatchSizeBase


class AutoBatchSize(AutoBatchSizeBase):
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.compat import (
from deepmd.utils.compat import (
convert_input_v0_v1,
convert_input_v1_v2,
deprecate_numb_test,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.data import (
from deepmd.utils.data import (
DeepmdData,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/data_system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.data_system import (
from deepmd.utils.data_system import (
DeepmdDataSystem,
prob_sys_size_ext,
process_sys_probs,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/errors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd_utils.utils.errors import (
from deepmd.utils.errors import (
OutOfMemoryError,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/pair_tab.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.pair_tab import (
from deepmd.utils.pair_tab import (
PairTab,
)

Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/path.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.path import (
from deepmd.utils.path import (
DPH5Path,
DPOSPath,
DPPath,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.plugin import (
from deepmd.utils.plugin import (
Plugin,
PluginVariant,
VariantABCMeta,
Expand Down
2 changes: 1 addition & 1 deletion deepmd/tf/utils/random.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Alias for backward compatibility."""
from deepmd_utils.utils.random import (
from deepmd.utils.random import (
choice,
random,
seed,
Expand Down
Loading