akernel 0.3.2__tar.gz → 0.3.3__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.
- {akernel-0.3.2 → akernel-0.3.3}/PKG-INFO +1 -1
- {akernel-0.3.2 → akernel-0.3.3}/pyproject.toml +1 -1
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/akernel.py +7 -8
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/kernel.py +0 -1
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/message.py +17 -12
- {akernel-0.3.2 → akernel-0.3.3}/.github/workflows/main.yml +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/.pre-commit-config.yaml +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/LICENSE +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/MANIFEST.in +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/README.md +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/binder/environment.yml +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/binder/postBuild +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/examples/concurrency.ipynb +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/examples/reactivity.ipynb +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/LICENSE +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/README.md +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/fps_akernel_task/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/fps_akernel_task/akernel_task.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/fps_akernel_task/main.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/fps_akernel_task/py.typed +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/plugins/akernel_task/pyproject.toml +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/share/jupyter/kernels/akernel/kernel.json +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/IPython/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/IPython/core/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/IPython/core/getipython.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/IPython/core/interactiveshell.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/cache.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/code.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/comm/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/comm/comm.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/comm/manager.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/connect.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/display/__init__.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/display/display.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/execution.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/kernelspec.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/src/akernel/traceback.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/tests/conftest.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/tests/test_async_code.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/tests/test_execution.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/tests/test_kernel.py +0 -0
- {akernel-0.3.2 → akernel-0.3.3}/tests/test_react_code.py +0 -0
|
@@ -9,7 +9,6 @@ from anyio import create_memory_object_stream, create_task_group, run, sleep_for
|
|
|
9
9
|
from .connect import connect_channel
|
|
10
10
|
from .kernel import Kernel
|
|
11
11
|
from .kernelspec import write_kernelspec
|
|
12
|
-
from .message import receive_message, send_message
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
cli = typer.Typer()
|
|
@@ -106,34 +105,34 @@ class AKernel:
|
|
|
106
105
|
|
|
107
106
|
async def to_shell(self) -> None:
|
|
108
107
|
while True:
|
|
109
|
-
msg = await
|
|
108
|
+
msg = await self.shell_channel.arecv_multipart().wait()
|
|
110
109
|
await self._to_shell_send_stream.send(msg)
|
|
111
110
|
|
|
112
111
|
async def from_shell(self) -> None:
|
|
113
112
|
async for msg in self._from_shell_receive_stream:
|
|
114
|
-
await
|
|
113
|
+
await self.shell_channel.asend_multipart(msg, copy=True).wait()
|
|
115
114
|
|
|
116
115
|
async def to_control(self) -> None:
|
|
117
116
|
while True:
|
|
118
|
-
msg = await
|
|
117
|
+
msg = await self.control_channel.arecv_multipart().wait()
|
|
119
118
|
await self._to_control_send_stream.send(msg)
|
|
120
119
|
|
|
121
120
|
async def from_control(self) -> None:
|
|
122
121
|
async for msg in self._from_control_receive_stream:
|
|
123
|
-
await
|
|
122
|
+
await self.control_channel.asend_multipart(msg, copy=True).wait()
|
|
124
123
|
|
|
125
124
|
async def to_stdin(self) -> None:
|
|
126
125
|
while True:
|
|
127
|
-
msg = await
|
|
126
|
+
msg = await self.stdin_channel.arecv_multipart().wait()
|
|
128
127
|
await self._to_stdin_send_stream.send(msg)
|
|
129
128
|
|
|
130
129
|
async def from_stdin(self) -> None:
|
|
131
130
|
async for msg in self._from_stdin_receive_stream:
|
|
132
|
-
await
|
|
131
|
+
await self.stdin_channel.asend_multipart(msg, copy=True).wait()
|
|
133
132
|
|
|
134
133
|
async def from_iopub(self) -> None:
|
|
135
134
|
async for msg in self._from_iopub_receive_stream:
|
|
136
|
-
await
|
|
135
|
+
await self.iopub_channel.asend_multipart(msg, copy=True).wait()
|
|
137
136
|
|
|
138
137
|
|
|
139
138
|
if __name__ == "__main__":
|
|
@@ -14,7 +14,6 @@ from akernel.comm.manager import CommManager
|
|
|
14
14
|
from akernel.display import display
|
|
15
15
|
import akernel.IPython
|
|
16
16
|
from akernel.IPython import core
|
|
17
|
-
from .connect import connect_channel
|
|
18
17
|
from .message import create_message, feed_identities, deserialize, serialize
|
|
19
18
|
from .execution import pre_execute, cache_execution
|
|
20
19
|
from .traceback import get_traceback
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import uuid
|
|
4
5
|
import hmac
|
|
5
6
|
import hashlib
|
|
6
7
|
from datetime import datetime, timezone
|
|
7
8
|
from typing import Any, cast
|
|
8
9
|
|
|
9
|
-
from zmq.utils import jsonapi
|
|
10
|
-
from zmq_anyio import Socket
|
|
11
10
|
from dateutil.parser import parse as dateutil_parse # type: ignore
|
|
12
11
|
|
|
13
12
|
|
|
@@ -97,24 +96,30 @@ def serialize(msg: dict[str, Any], key: str) -> list[bytes]:
|
|
|
97
96
|
return to_send
|
|
98
97
|
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return None
|
|
99
|
+
def dumps(o: Any, **kwargs) -> bytes:
|
|
100
|
+
"""Serialize object to JSON bytes (utf-8).
|
|
103
101
|
|
|
102
|
+
Keyword arguments are passed along to :py:func:`json.dumps`.
|
|
103
|
+
"""
|
|
104
|
+
return json.dumps(o, **kwargs).encode("utf8")
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
|
|
107
|
+
def loads(s: bytes | str, **kwargs) -> dict | list | str | int | float:
|
|
108
|
+
"""Load object from JSON bytes (utf-8).
|
|
109
|
+
|
|
110
|
+
Keyword arguments are passed along to :py:func:`json.loads`.
|
|
111
|
+
"""
|
|
112
|
+
if isinstance(s, bytes):
|
|
113
|
+
s = s.decode("utf8")
|
|
114
|
+
return json.loads(s, **kwargs)
|
|
110
115
|
|
|
111
116
|
|
|
112
117
|
def pack(obj: dict[str, Any]) -> bytes:
|
|
113
|
-
return
|
|
118
|
+
return dumps(obj)
|
|
114
119
|
|
|
115
120
|
|
|
116
121
|
def unpack(s: bytes) -> dict[str, Any]:
|
|
117
|
-
return cast(dict[str, Any],
|
|
122
|
+
return cast(dict[str, Any], loads(s))
|
|
118
123
|
|
|
119
124
|
|
|
120
125
|
def sign(msg_list: list[bytes], key: str) -> bytes:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|