Skip to content
Open
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
19 changes: 19 additions & 0 deletions src/deephaven/plugin/js.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

from . import Plugin

JsonValue = typing.Union[
None,
bool,
int,
float,
str,
typing.List["JsonValue"],
typing.Dict[str, "JsonValue"],
]
"""A JSON node; any value that can be represented in JSON."""
Comment on lines +7 to +16

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to hold up this change, but we might consider bumping our python minimum version here in the future, so we could use the more "modern" (aka 2022) suggestion from python/typing#182 (comment)

JSON: TypeAlias = dict[str, "JSON"] | list["JSON"] | str | int | float | bool | None



class JsPlugin(Plugin):
"""
Expand Down Expand Up @@ -46,5 +57,13 @@ def main(self) -> str:
"""
pass

@property
def loader(self) -> typing.Optional[JsonValue]:
"""
The optional JS plugin loader configuration. When not None, will be included as the "loader" field for
the manifest entry in "js-plugins/manifest.json". Defaults to None.
"""
return None

def __str__(self) -> str:
return f"{self.name}@{self.version}"
Loading