|
22 | 22 | from traitlets import Unicode, observe |
23 | 23 | from .viewer import PerspectiveViewer |
24 | 24 |
|
25 | | -__version__ = re.sub( |
26 | | - "(rc|alpha|beta)", "-\\1.", importlib.metadata.version("perspective-python") |
27 | | -) |
| 25 | +__version__ = re.sub(".dev[0-9]+", "", importlib.metadata.version("perspective-python")) |
28 | 26 |
|
29 | 27 | __all__ = ["PerspectiveWidget"] |
30 | 28 |
|
| 29 | + |
31 | 30 | class PerspectiveWidget(DOMWidget, PerspectiveViewer): |
32 | 31 | """:class`~perspective.PerspectiveWidget` allows for Perspective to be used |
33 | 32 | in the form of a Jupyter IPython widget. |
@@ -160,6 +159,7 @@ def __init__( |
160 | 159 | loading = self.load(data, **self._options) |
161 | 160 | if inspect.isawaitable(loading): |
162 | 161 | import asyncio |
| 162 | + |
163 | 163 | asyncio.create_task(loading) |
164 | 164 |
|
165 | 165 | def load(self, data, **options): |
@@ -212,16 +212,16 @@ def handle_message(self, widget, content, buffers): |
212 | 212 | logging.debug("view {} connected", client_id) |
213 | 213 |
|
214 | 214 | def send_response(msg): |
215 | | - self.send( |
216 | | - {"type": "binary_msg", "client_id": client_id}, [msg] |
217 | | - ) |
| 215 | + self.send({"type": "binary_msg", "client_id": client_id}, [msg]) |
| 216 | + |
218 | 217 | self._sessions[client_id] = self.new_proxy_session(send_response) |
219 | 218 | elif content["type"] == "binary_msg": |
220 | 219 | [binary_msg] = buffers |
221 | 220 | client_id = content["client_id"] |
222 | 221 | session = self._sessions[client_id] |
223 | 222 | if session is not None: |
224 | 223 | import asyncio |
| 224 | + |
225 | 225 | asyncio.create_task(session.handle_request_async(binary_msg)) |
226 | 226 | else: |
227 | 227 | logging.error("No session for client_id {}".format(client_id)) |
|
0 commit comments