Skip to content
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

Add DP-GUI entry-points to DeepModeling packages #270

Closed
4 tasks done
njzjz opened this issue Oct 8, 2023 · 0 comments
Closed
4 tasks done

Add DP-GUI entry-points to DeepModeling packages #270

njzjz opened this issue Oct 8, 2023 · 0 comments
Assignees

Comments

@njzjz
Copy link
Member

njzjz commented Oct 8, 2023

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.

image

Here, when dpdispatcher is installed and has the dpgui entry points, DP-GUI can detect it.


Below are the required changes:

  1. 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.

  1. 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.

  1. 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:

@njzjz njzjz self-assigned this Oct 8, 2023
wanghan-iapcm pushed a commit to deepmodeling/deepmd-kit that referenced this issue Oct 9, 2023
See deepmodeling/dpgui#270 for details.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
wanghan-iapcm pushed a commit to deepmodeling/dpgen2 that referenced this issue Oct 9, 2023
See deepmodeling/dpgui#270 for details.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
wanghan-iapcm pushed a commit to deepmodeling/dpgen that referenced this issue Oct 9, 2023
See deepmodeling/dpgui#270 for details.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
njzjz added a commit to deepmodeling/dpdispatcher that referenced this issue Oct 9, 2023
See deepmodeling/dpgui#270 for details.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@njzjz njzjz closed this as completed Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant