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

fix: Correct type for generated JsPlugin #741

Merged
merged 9 commits into from
Sep 19, 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
2 changes: 1 addition & 1 deletion plugins/matplotlib/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
32 changes: 0 additions & 32 deletions plugins/matplotlib/src/deephaven/plugin/matplotlib/_js_plugin.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)
2 changes: 1 addition & 1 deletion plugins/plotly-express/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
32 changes: 0 additions & 32 deletions plugins/plotly-express/src/deephaven/plot/express/_js_plugin.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
2 changes: 1 addition & 1 deletion plugins/ui/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 0 additions & 32 deletions plugins/ui/src/deephaven/ui/_js_plugin.py

This file was deleted.

9 changes: 1 addition & 8 deletions plugins/ui/src/deephaven/ui/_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
2 changes: 1 addition & 1 deletion plugins/utilities/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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)
Loading