diff --git a/plugins/matplotlib/setup.cfg b/plugins/matplotlib/setup.cfg index 09af60996..4fb380b96 100644 --- a/plugins/matplotlib/setup.cfg +++ b/plugins/matplotlib/setup.cfg @@ -29,7 +29,7 @@ install_requires = jpy>=0.14.0 deephaven-plugin>=0.5.0 matplotlib - deephaven-plugin-utilities + deephaven-plugin-utilities>=0.0.2 include_package_data = True [options.extras_require] diff --git a/plugins/matplotlib/src/deephaven/plugin/matplotlib/_js_plugin.py b/plugins/matplotlib/src/deephaven/plugin/matplotlib/_js_plugin.py deleted file mode 100644 index 7c2e9bf65..000000000 --- a/plugins/matplotlib/src/deephaven/plugin/matplotlib/_js_plugin.py +++ /dev/null @@ -1,32 +0,0 @@ -import pathlib - -from deephaven.plugin.js import JsPlugin - - -class MatplotlibJsPlugin(JsPlugin): - def __init__( - self, - name: str, - version: str, - main: str, - path: pathlib.Path, - ) -> None: - self._name = name - self._version = version - self._main = main - self._path = path - - @property - def name(self) -> str: - return self._name - - @property - def version(self) -> str: - return self._version - - @property - def main(self) -> str: - return self._main - - def path(self) -> pathlib.Path: - return self._path diff --git a/plugins/matplotlib/src/deephaven/plugin/matplotlib/_register.py b/plugins/matplotlib/src/deephaven/plugin/matplotlib/_register.py index 33d18567a..23b18c32f 100644 --- a/plugins/matplotlib/src/deephaven/plugin/matplotlib/_register.py +++ b/plugins/matplotlib/src/deephaven/plugin/matplotlib/_register.py @@ -2,11 +2,9 @@ import matplotlib.pyplot as plt from deephaven.plugin import Registration, Callback from deephaven.plugin.utilities import create_js_plugin, DheSafeCallbackWrapper -from ._js_plugin import MatplotlibJsPlugin PACKAGE_NAMESPACE = "deephaven.plugin.matplotlib" JS_NAME = "_js" -PLUGIN_CLASS = MatplotlibJsPlugin def _init_theme(): @@ -30,10 +28,6 @@ def register_into(cls, callback: Callback) -> None: callback.register(figure_type.FigureType) - js_plugin = create_js_plugin( - PACKAGE_NAMESPACE, - JS_NAME, - PLUGIN_CLASS, - ) + js_plugin = create_js_plugin(PACKAGE_NAMESPACE, JS_NAME) callback.register(js_plugin) diff --git a/plugins/plotly-express/setup.cfg b/plugins/plotly-express/setup.cfg index 94db3d940..6a6334208 100644 --- a/plugins/plotly-express/setup.cfg +++ b/plugins/plotly-express/setup.cfg @@ -28,7 +28,7 @@ install_requires = deephaven-core>=0.36.0 deephaven-plugin>=0.6.0 plotly - deephaven-plugin-utilities + deephaven-plugin-utilities>=0.0.2 include_package_data = True [options.packages.find] diff --git a/plugins/plotly-express/src/deephaven/plot/express/_js_plugin.py b/plugins/plotly-express/src/deephaven/plot/express/_js_plugin.py deleted file mode 100644 index f1df67cba..000000000 --- a/plugins/plotly-express/src/deephaven/plot/express/_js_plugin.py +++ /dev/null @@ -1,32 +0,0 @@ -import pathlib - -from deephaven.plugin.js import JsPlugin - - -class ExpressJsPlugin(JsPlugin): - def __init__( - self, - name: str, - version: str, - main: str, - path: pathlib.Path, - ) -> None: - self._name = name - self._version = version - self._main = main - self._path = path - - @property - def name(self) -> str: - return self._name - - @property - def version(self) -> str: - return self._version - - @property - def main(self) -> str: - return self._main - - def path(self) -> pathlib.Path: - return self._path diff --git a/plugins/plotly-express/src/deephaven/plot/express/_register.py b/plugins/plotly-express/src/deephaven/plot/express/_register.py index 4a2f27bb7..2cc711117 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/_register.py +++ b/plugins/plotly-express/src/deephaven/plot/express/_register.py @@ -2,11 +2,9 @@ from deephaven.plugin import Registration, Callback from deephaven.plugin.utilities import create_js_plugin, DheSafeCallbackWrapper from . import DeephavenFigureType -from ._js_plugin import ExpressJsPlugin PACKAGE_NAMESPACE = "deephaven.plot.express" JS_NAME = "_js" -PLUGIN_CLASS = ExpressJsPlugin class ExpressRegistration(Registration): @@ -31,10 +29,6 @@ def register_into(cls, callback: Callback) -> None: callback.register(DeephavenFigureType) - js_plugin = create_js_plugin( - PACKAGE_NAMESPACE, - JS_NAME, - PLUGIN_CLASS, - ) + js_plugin = create_js_plugin(PACKAGE_NAMESPACE, JS_NAME) callback.register(js_plugin) diff --git a/plugins/ui/setup.cfg b/plugins/ui/setup.cfg index ac4e8e7f4..5f66c9051 100644 --- a/plugins/ui/setup.cfg +++ b/plugins/ui/setup.cfg @@ -28,7 +28,7 @@ install_requires = deephaven-core>=0.34.1 deephaven-plugin>=0.6.0 json-rpc - deephaven-plugin-utilities + deephaven-plugin-utilities>=0.0.2 typing_extensions;python_version<'3.11' include_package_data = True diff --git a/plugins/ui/src/deephaven/ui/_js_plugin.py b/plugins/ui/src/deephaven/ui/_js_plugin.py deleted file mode 100644 index fa3b9a05e..000000000 --- a/plugins/ui/src/deephaven/ui/_js_plugin.py +++ /dev/null @@ -1,32 +0,0 @@ -import pathlib - -from deephaven.plugin.js import JsPlugin - - -class UiJsPlugin(JsPlugin): - def __init__( - self, - name: str, - version: str, - main: str, - path: pathlib.Path, - ) -> None: - self._name = name - self._version = version - self._main = main - self._path = path - - @property - def name(self) -> str: - return self._name - - @property - def version(self) -> str: - return self._version - - @property - def main(self) -> str: - return self._main - - def path(self) -> pathlib.Path: - return self._path diff --git a/plugins/ui/src/deephaven/ui/_register.py b/plugins/ui/src/deephaven/ui/_register.py index 3dfe4502b..b79755a64 100644 --- a/plugins/ui/src/deephaven/ui/_register.py +++ b/plugins/ui/src/deephaven/ui/_register.py @@ -2,11 +2,8 @@ from deephaven.plugin import Registration, Callback from deephaven.plugin.utilities import create_js_plugin, DheSafeCallbackWrapper -from ._js_plugin import UiJsPlugin - PACKAGE_NAMESPACE = "deephaven.ui" JS_NAME = "_js" -PLUGIN_CLASS = UiJsPlugin class UIRegistration(Registration): @@ -18,10 +15,6 @@ def register_into(cls, callback: Callback) -> None: callback.register(DashboardType) callback.register(ElementType) - js_plugin = create_js_plugin( - PACKAGE_NAMESPACE, - JS_NAME, - PLUGIN_CLASS, - ) + js_plugin = create_js_plugin(PACKAGE_NAMESPACE, JS_NAME) callback.register(js_plugin) diff --git a/plugins/utilities/setup.cfg b/plugins/utilities/setup.cfg index 308cd2e58..4ee51e716 100644 --- a/plugins/utilities/setup.cfg +++ b/plugins/utilities/setup.cfg @@ -3,7 +3,7 @@ name = deephaven-plugin-utilities description = Deephaven Plugin Utilities long_description = file: README.md long_description_content_type = text/markdown -version = 0.0.2.dev0 +version = 0.0.3.dev0 url = https://github.com/deephaven/deephaven-plugins project_urls = Source Code = https://github.com/deephaven/deephaven-plugins diff --git a/templates/widget/{{ cookiecutter.python_project_name }}/README.md b/templates/widget/{{ cookiecutter.python_project_name }}/README.md index 458631eb7..ae50f2465 100644 --- a/templates/widget/{{ cookiecutter.python_project_name }}/README.md +++ b/templates/widget/{{ cookiecutter.python_project_name }}/README.md @@ -13,8 +13,7 @@ Within the `src` directory, the {{ cookiecutter.python_project_name }} directory The Python files have the following structure: `{{ cookiecutter.__object_file_name }}.py` defines a simple Python class that can send messages to the client. This object can be modified to have other plugin functionality or replaced with a different object entirely, depending on the plugin's needs. `{{ cookiecutter.__type_file_name }}.py` defines the Python type for the plugin (which is used for registration) and a simple message stream. These can be modified to handle different objects or messages. An initial message is sent from the Python side to the client, then additional messages can be sent back and forth. -`js_plugin.py` defines the Python class that will be used to setup the JavaScript side of the plugin. -`register.py` registers the plugin with Deephaven. This file will not need to be modified for most plugins at the initial stages, but will need to be if the package is renamed or JavaScript files are moved. +`register.py` registers the plugin with Deephaven. This file will not need to be modified for most plugins at the initial stages, but will need to be if the package is renamed or JavaScript files are moved. The JavaScript files have the following structure: `{{ cookiecutter.__js_plugin_obj }}.ts` registers the plugin with Deephaven. This contains the client equivalent of the type in `{{ cookiecutter.__type_file_name }}.py` and these should be kept in sync. diff --git a/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/js_plugin.py b/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/js_plugin.py deleted file mode 100644 index 1cc424257..000000000 --- a/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/js_plugin.py +++ /dev/null @@ -1,34 +0,0 @@ -import pathlib - -from deephaven.plugin.js import JsPlugin - - -# This plugin allows the Python plugin to register a JavaScript plugin. -# The properties will be filled in during the registration process. -class {{ cookiecutter.__py_js_plugin_obj_name }}(JsPlugin): - def __init__( - self, - name: str, - version: str, - main: str, - path: pathlib.Path, - ) -> None: - self._name = name - self._version = version - self._main = main - self._path = path - - @property - def name(self) -> str: - return self._name - - @property - def version(self) -> str: - return self._version - - @property - def main(self) -> str: - return self._main - - def path(self) -> pathlib.Path: - return self._path diff --git a/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/register.py b/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/register.py index b30fce84a..fd55450d8 100644 --- a/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/register.py +++ b/templates/widget/{{ cookiecutter.python_project_name }}/src/{{ cookiecutter.__src_folder_name }}/register.py @@ -1,15 +1,12 @@ from deephaven.plugin import Registration, Callback from deephaven.plugin.utilities import create_js_plugin, DheSafeCallbackWrapper -from .js_plugin import {{ cookiecutter.__py_js_plugin_obj_name }} from .{{ cookiecutter.__type_file_name }} import {{ cookiecutter.__type_name }} # The namespace that the Python plugin will be registered under. PACKAGE_NAMESPACE = "{{cookiecutter.__py_namespace}}" # Where the Javascript plugin is. This is set in setup.py. JS_NAME = "_js" -# The JsPlugin class that will be created and registered. -PLUGIN_CLASS = {{ cookiecutter.__py_js_plugin_obj_name }} class {{ cookiecutter.__registration_name }}(Registration): @@ -23,8 +20,7 @@ def register_into(cls, callback: Callback) -> None: # The JavaScript plugin requires a special registration process, which is handled here js_plugin = create_js_plugin( PACKAGE_NAMESPACE, - JS_NAME, - PLUGIN_CLASS, + JS_NAME ) callback.register(js_plugin)