deephaven-plugin 0.5.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: deephaven-plugin
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: Deephaven Plugin interface
5
5
  Home-page: https://github.com/deephaven/deephaven-plugin
6
6
  Author: Devin Smith
@@ -16,6 +16,8 @@ Classifier: Environment :: Plugins
16
16
  Classifier: Development Status :: 3 - Alpha
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
+ Requires-Dist: importlib-metadata>=3.6; python_version < "3.8"
20
+ Dynamic: license-file
19
21
 
20
22
  # Deephaven Plugin interface
21
23
 
@@ -5,7 +5,7 @@ from typing import Union, Type
5
5
  The deephaven.plugin module provides an API and registration mechanism to add new behavior to the Deephaven
6
6
  server. Plugins should be registered by adding a Registration instance as an entrypoint to the Python package.
7
7
  """
8
- __version__ = "0.5.0"
8
+ __version__ = "0.7.0"
9
9
 
10
10
  DEEPHAVEN_PLUGIN_ENTRY_KEY = "deephaven.plugin"
11
11
  DEEPHAVEN_PLUGIN_REGISTRATION_CLASS = "registration_cls"
@@ -0,0 +1,50 @@
1
+ import abc
2
+ import pathlib
3
+ import typing
4
+
5
+ from . import Plugin
6
+
7
+
8
+ class JsPlugin(Plugin):
9
+ """
10
+ A JS plugin is a Plugin that allows adding javascript code under the server's URL path "js-plugins/".
11
+ See https://github.com/deephaven/deephaven-plugins#js-plugins for more details about the underlying
12
+ construction for JS plugins.
13
+ """
14
+
15
+ @abc.abstractmethod
16
+ def path(self) -> pathlib.Path:
17
+ """
18
+ The directory path of the resources to serve. The path must exist.
19
+ """
20
+ pass
21
+
22
+ @property
23
+ @abc.abstractmethod
24
+ def name(self) -> str:
25
+ """
26
+ The JS plugin name. The JS plugin contents will be served via the URL path "js-plugins/{name}/",
27
+ as well as included as the "name" field for the manifest entry in "js-plugins/manifest.json".
28
+ """
29
+ pass
30
+
31
+ @property
32
+ @abc.abstractmethod
33
+ def version(self) -> str:
34
+ """
35
+ The JS plugin version. Will be included as the "version" field for the manifest entry in
36
+ js-plugins/manifest.json".
37
+ """
38
+ pass
39
+
40
+ @property
41
+ @abc.abstractmethod
42
+ def main(self) -> str:
43
+ """
44
+ The main JS file path, specified relative to root. The main JS file must exist. Will be included
45
+ as the "main" field for the manifest entry in "js-plugins/manifest.json".
46
+ """
47
+ pass
48
+
49
+ def __str__(self) -> str:
50
+ return f"{self.name}@{self.version}"
@@ -1,5 +1,5 @@
1
1
  import abc
2
- from typing import Optional, Union, Type, List, Any
2
+ from typing import Literal, Optional, Union, Type, List, Any
3
3
 
4
4
  from . import Plugin, Registration, register_all_into
5
5
 
@@ -69,6 +69,22 @@ class ObjectType(Plugin):
69
69
  """Returns True if, and only if, the object is compatible with this object type."""
70
70
  pass
71
71
 
72
+ def authorization_export_behavior(self) -> Literal["transform", "manual", "unset"]:
73
+ """Declares how the server should authorize the references this plugin exports to the client.
74
+
75
+ - ``"transform"``: the server applies the authorization transform to every reference this plugin exports,
76
+ in the requesting user's context. Use this when the plugin does not apply authorization itself.
77
+ - ``"manual"``: the plugin takes responsibility for authorizing its own exported references (for example by
78
+ calling ``deephaven.plugin_authorization.transform`` before passing objects to ``on_data``). The server
79
+ does not additionally transform them.
80
+ - ``"unset"`` (default): the plugin makes no declaration. The server's
81
+ ``PluginReferenceAuthorization.failClosed`` policy determines the effective behavior.
82
+
83
+ Returns:
84
+ One of ``"transform"``, ``"manual"``, or ``"unset"``.
85
+ """
86
+ return "unset"
87
+
72
88
 
73
89
  class BidirectionalObjectType(ObjectType):
74
90
  """Base class for an object type that can continue to send responses to the client, or receive requests
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: deephaven-plugin
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: Deephaven Plugin interface
5
5
  Home-page: https://github.com/deephaven/deephaven-plugin
6
6
  Author: Devin Smith
@@ -16,6 +16,8 @@ Classifier: Environment :: Plugins
16
16
  Classifier: Development Status :: 3 - Alpha
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
+ Requires-Dist: importlib-metadata>=3.6; python_version < "3.8"
20
+ Dynamic: license-file
19
21
 
20
22
  # Deephaven Plugin interface
21
23
 
@@ -1,35 +0,0 @@
1
- import abc
2
- import pathlib
3
- import typing
4
-
5
- from . import Plugin
6
-
7
-
8
- class JsPlugin(Plugin):
9
- """A js plugin. Useful for adding custom JS code to the server that can be passed to the web client."""
10
-
11
- @abc.abstractmethod
12
- def distribution_path(self) -> typing.Generator[pathlib.Path, None, None]:
13
- """A generator that yields the distribution path directory."""
14
- pass
15
-
16
- @property
17
- @abc.abstractmethod
18
- def name(self) -> str:
19
- """The plugin name"""
20
- pass
21
-
22
- @property
23
- @abc.abstractmethod
24
- def version(self) -> str:
25
- """The plugin version"""
26
- pass
27
-
28
- @property
29
- @abc.abstractmethod
30
- def main(self) -> str:
31
- """The main js file, the relative path with respect to distribution_path."""
32
- pass
33
-
34
- def __str__(self) -> str:
35
- return f"{self.name}@{self.version}"