-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Previously, DP-GUI was only hosted online, so the package input may not be the latest to match the stable or development version or another version that one may use. To resolve this issue, I made DP-GUI an independent Python library that can be served in the local environment. The Python package can read the arguments of the installed packages through entry points.
Here, when dpdispatcher is installed and has the dpgui entry points, DP-GUI can detect it.
Below are the required changes:
- Add the entry points to
pyproject.toml:
[project.entry-points."dpgui"]
"DPDispatcher Machine" = "dpdispatcher.arginfo:machine_dargs"
"DPDispatcher Resources" = "dpdispatcher.arginfo:resources_dargs"
"DPDispatcher Task" = "dpdispatcher.arginfo:task_dargs"The method is the same as that for the dargs Sphinx plugin, so no extra Python methods are required to add.
- Add a unit test:
import unittest
from dpgui import generate_dpgui_templates
class TestDPGUI(unittest.TestCase):
def test_dpgui_entrypoints(self):
self.assertTrue(len(generate_dpgui_templates()) > 0)This is a simple way to validate the entry points.
- add the scripts and arguments to start DP-GUI
def start_dpgui(*, port: int, bind_all: bool, **kwargs):
try:
from dpgui import start_dpgui
except ModuleNotFoundError as e:
raise ModuleNotFoundError("To use DP-GUI, please install the dpgui package:\npip install dpgui") from e
start_dpgui(port=port, bind_all=bind_all)Below is a checklist for DeepModeling packages that support DP-GUI:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
