Skip to content

Commit 89d9a88

Browse files
authored
move deepmd.entrypoints.{doc,gui} to deepmd_utils.entrypoints.{doc,gui} (#3144)
See #3118 --------- Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 539e4ab commit 89d9a88

File tree

5 files changed

+58
-45
lines changed

5 files changed

+58
-45
lines changed

deepmd/entrypoints/doc.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2-
"""Module that prints train input arguments docstrings."""
3-
4-
from deepmd.utils.argcheck import (
5-
gen_doc,
6-
gen_json,
2+
from deepmd_utils.entrypoints.doc import (
3+
doc_train_input,
74
)
85

96
__all__ = ["doc_train_input"]
10-
11-
12-
def doc_train_input(*, out_type: str = "rst", **kwargs):
13-
"""Print out trining input arguments to console."""
14-
if out_type == "rst":
15-
doc_str = gen_doc(make_anchor=True)
16-
elif out_type == "json":
17-
doc_str = gen_json()
18-
else:
19-
raise RuntimeError("Unsupported out type %s" % out_type)
20-
print(doc_str)

deepmd/entrypoints/gui.py

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2-
"""DP-GUI entrypoint."""
2+
from deepmd_utils.entrypoints.gui import (
3+
start_dpgui,
4+
)
35

4-
5-
def start_dpgui(*, port: int, bind_all: bool, **kwargs):
6-
"""Host DP-GUI server.
7-
8-
Parameters
9-
----------
10-
port : int
11-
The port to serve DP-GUI on.
12-
bind_all : bool
13-
Serve on all public interfaces. This will expose your DP-GUI instance
14-
to the network on both IPv4 and IPv6 (where available).
15-
**kwargs
16-
additional arguments
17-
18-
Raises
19-
------
20-
ModuleNotFoundError
21-
The dpgui package is not installed
22-
"""
23-
try:
24-
from dpgui import (
25-
start_dpgui,
26-
)
27-
except ModuleNotFoundError as e:
28-
raise ModuleNotFoundError(
29-
"To use DP-GUI, please install the dpgui package:\npip install dpgui"
30-
) from e
31-
start_dpgui(port=port, bind_all=bind_all)
6+
__all__ = ["start_dpgui"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# SPDX-License-Identifier: LGPL-3.0-or-later

deepmd_utils/entrypoints/doc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
"""Module that prints train input arguments docstrings."""
3+
4+
from deepmd_utils.utils.argcheck import (
5+
gen_doc,
6+
gen_json,
7+
)
8+
9+
__all__ = ["doc_train_input"]
10+
11+
12+
def doc_train_input(*, out_type: str = "rst", **kwargs):
13+
"""Print out trining input arguments to console."""
14+
if out_type == "rst":
15+
doc_str = gen_doc(make_anchor=True)
16+
elif out_type == "json":
17+
doc_str = gen_json()
18+
else:
19+
raise RuntimeError("Unsupported out type %s" % out_type)
20+
print(doc_str)

deepmd_utils/entrypoints/gui.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
"""DP-GUI entrypoint."""
3+
4+
5+
def start_dpgui(*, port: int, bind_all: bool, **kwargs):
6+
"""Host DP-GUI server.
7+
8+
Parameters
9+
----------
10+
port : int
11+
The port to serve DP-GUI on.
12+
bind_all : bool
13+
Serve on all public interfaces. This will expose your DP-GUI instance
14+
to the network on both IPv4 and IPv6 (where available).
15+
**kwargs
16+
additional arguments
17+
18+
Raises
19+
------
20+
ModuleNotFoundError
21+
The dpgui package is not installed
22+
"""
23+
try:
24+
from dpgui import (
25+
start_dpgui,
26+
)
27+
except ModuleNotFoundError as e:
28+
raise ModuleNotFoundError(
29+
"To use DP-GUI, please install the dpgui package:\npip install dpgui"
30+
) from e
31+
start_dpgui(port=port, bind_all=bind_all)

0 commit comments

Comments
 (0)