txl-kernel 0.3.8__tar.gz → 0.3.10__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.
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/PKG-INFO +8 -7
- txl_kernel-0.3.10/pyproject.toml +20 -0
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/txl_kernel/driver.py +30 -18
- txl_kernel-0.3.8/pyproject.toml +0 -20
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/.gitignore +0 -0
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/LICENSE.txt +0 -0
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/README.md +0 -0
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/txl_kernel/__init__.py +0 -0
- {txl_kernel-0.3.8 → txl_kernel-0.3.10}/txl_kernel/message.py +0 -0
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: txl_kernel
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.10
|
|
4
4
|
Summary: TXL plugin for a kernel driver
|
|
5
|
-
Project-URL: Source, https://github.com/davidbrochart/jpterm/plugins/kernel
|
|
5
|
+
Project-URL: Source, https://github.com/davidbrochart/jpterm/tree/main/plugins/kernel
|
|
6
6
|
Author-email: David Brochart <david.brochart@gmail.com>
|
|
7
7
|
License-Expression: MIT
|
|
8
8
|
License-File: LICENSE.txt
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Programming Language :: Python
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
15
16
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
16
17
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
17
|
-
Requires-Python: >=3.
|
|
18
|
-
Requires-Dist: pycrdt<0.
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: pycrdt<0.15.0,>=0.14.1
|
|
19
20
|
Requires-Dist: python-dateutil>=2.8.2
|
|
20
|
-
Requires-Dist: txl==0.3.
|
|
21
|
+
Requires-Dist: txl==0.3.4
|
|
21
22
|
Description-Content-Type: text/markdown
|
|
22
23
|
|
|
23
24
|
# TXL plugin for a kernel driver
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [ "hatchling",]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "txl_kernel"
|
|
7
|
+
version = "0.3.10"
|
|
8
|
+
description = "TXL plugin for a kernel driver"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = []
|
|
13
|
+
classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy",]
|
|
14
|
+
dependencies = [ "txl ==0.3.4", "python-dateutil >=2.8.2", "pycrdt >=0.14.1,<0.15.0",]
|
|
15
|
+
[[project.authors]]
|
|
16
|
+
name = "David Brochart"
|
|
17
|
+
email = "david.brochart@gmail.com"
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Source = "https://github.com/davidbrochart/jpterm/tree/main/plugins/kernel"
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import math
|
|
1
2
|
import time
|
|
2
|
-
from typing import Dict
|
|
3
|
+
from typing import Any, Dict
|
|
3
4
|
|
|
4
|
-
from anyio import move_on_after
|
|
5
|
-
from anyioutils import Event, Queue, create_task
|
|
5
|
+
from anyio import Event, create_memory_object_stream, move_on_after
|
|
6
6
|
from fps import Signal
|
|
7
7
|
from pycrdt import Array, Map
|
|
8
8
|
|
|
9
|
+
from txl.stapled import StapledObjectStream
|
|
10
|
+
|
|
9
11
|
from .message import create_message
|
|
10
12
|
|
|
11
13
|
|
|
@@ -31,8 +33,8 @@ class Comm:
|
|
|
31
33
|
buffers=buffers,
|
|
32
34
|
)
|
|
33
35
|
self.msg_cnt += 1
|
|
34
|
-
create_task(
|
|
35
|
-
self.send_message(msg, self.shell_channel, change_date_to_str=True)
|
|
36
|
+
self.task_group.create_task(
|
|
37
|
+
self.send_message(msg, self.shell_channel, change_date_to_str=True)
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
|
|
@@ -41,10 +43,12 @@ class KernelMixin:
|
|
|
41
43
|
self.task_group = task_group
|
|
42
44
|
self.busy = Signal[bool]()
|
|
43
45
|
self.msg_cnt = 0
|
|
44
|
-
self.execute_requests: Dict[str, Dict[str,
|
|
45
|
-
self.recv_queue =
|
|
46
|
+
self.execute_requests: Dict[str, Dict[str, StapledObjectStream]] = {}
|
|
47
|
+
self.recv_queue = StapledObjectStream(
|
|
48
|
+
*create_memory_object_stream[Any](max_buffer_size=math.inf)
|
|
49
|
+
)
|
|
46
50
|
self.started = Event()
|
|
47
|
-
create_task(self.recv()
|
|
51
|
+
task_group.create_task(self.recv())
|
|
48
52
|
|
|
49
53
|
def create_message(self, *args, **kwargs):
|
|
50
54
|
return create_message(*args, **kwargs)
|
|
@@ -62,18 +66,22 @@ class KernelMixin:
|
|
|
62
66
|
await self.send_message(msg, self.shell_channel, change_date_to_str=True)
|
|
63
67
|
msg_id = msg["header"]["msg_id"]
|
|
64
68
|
self.execute_requests[msg_id] = {
|
|
65
|
-
"iopub":
|
|
66
|
-
|
|
69
|
+
"iopub": StapledObjectStream(
|
|
70
|
+
*create_memory_object_stream[Any](max_buffer_size=math.inf)
|
|
71
|
+
),
|
|
72
|
+
"shell": StapledObjectStream(
|
|
73
|
+
*create_memory_object_stream[Any](max_buffer_size=math.inf)
|
|
74
|
+
),
|
|
67
75
|
}
|
|
68
76
|
with move_on_after(new_timeout) as scope:
|
|
69
|
-
msg = await self.execute_requests[msg_id]["shell"].
|
|
77
|
+
msg = await self.execute_requests[msg_id]["shell"].receive()
|
|
70
78
|
if scope.cancelled_caught:
|
|
71
79
|
del self.execute_requests[msg_id]
|
|
72
80
|
error_message = f"Kernel didn't respond in {timeout} seconds"
|
|
73
81
|
raise RuntimeError(error_message)
|
|
74
82
|
if msg["header"]["msg_type"] == "kernel_info_reply":
|
|
75
83
|
with move_on_after(0.2) as scope:
|
|
76
|
-
msg = await self.execute_requests[msg_id]["iopub"].
|
|
84
|
+
msg = await self.execute_requests[msg_id]["iopub"].receive()
|
|
77
85
|
if not scope.cancelled_caught:
|
|
78
86
|
break
|
|
79
87
|
del self.execute_requests[msg_id]
|
|
@@ -81,7 +89,7 @@ class KernelMixin:
|
|
|
81
89
|
|
|
82
90
|
async def recv(self):
|
|
83
91
|
while True:
|
|
84
|
-
msg = await self.recv_queue.
|
|
92
|
+
msg = await self.recv_queue.receive()
|
|
85
93
|
channel = msg.pop("channel")
|
|
86
94
|
msg_type = msg["header"]["msg_type"]
|
|
87
95
|
if msg_type == "comm_open":
|
|
@@ -108,7 +116,7 @@ class KernelMixin:
|
|
|
108
116
|
if msg_id in self.execute_requests:
|
|
109
117
|
# msg["header"] = str_to_date(msg["header"])
|
|
110
118
|
# msg["parent_header"] = str_to_date(msg["parent_header"])
|
|
111
|
-
self.execute_requests[msg_id][channel].
|
|
119
|
+
self.execute_requests[msg_id][channel].send_nowait(msg)
|
|
112
120
|
|
|
113
121
|
async def execute(
|
|
114
122
|
self,
|
|
@@ -136,15 +144,19 @@ class KernelMixin:
|
|
|
136
144
|
msg_id = msg["header"]["msg_id"]
|
|
137
145
|
self.msg_cnt += 1
|
|
138
146
|
self.execute_requests[msg_id] = {
|
|
139
|
-
"iopub":
|
|
140
|
-
|
|
147
|
+
"iopub": StapledObjectStream(
|
|
148
|
+
*create_memory_object_stream[Any](max_buffer_size=math.inf)
|
|
149
|
+
),
|
|
150
|
+
"shell": StapledObjectStream(
|
|
151
|
+
*create_memory_object_stream[Any](max_buffer_size=math.inf)
|
|
152
|
+
),
|
|
141
153
|
}
|
|
142
154
|
await self.send_message(msg, self.shell_channel, change_date_to_str=True)
|
|
143
155
|
if wait_for_executed:
|
|
144
156
|
deadline = time.monotonic() + timeout
|
|
145
157
|
while True:
|
|
146
158
|
with move_on_after(deadline_to_timeout(deadline)) as scope:
|
|
147
|
-
msg = await self.execute_requests[msg_id]["iopub"].
|
|
159
|
+
msg = await self.execute_requests[msg_id]["iopub"].receive()
|
|
148
160
|
if scope.cancelled_caught:
|
|
149
161
|
del self.execute_requests[msg_id]
|
|
150
162
|
error_message = f"Kernel didn't respond in {timeout} seconds"
|
|
@@ -156,7 +168,7 @@ class KernelMixin:
|
|
|
156
168
|
):
|
|
157
169
|
break
|
|
158
170
|
with move_on_after(deadline_to_timeout(deadline)) as scope:
|
|
159
|
-
msg = await self.execute_requests[msg_id]["shell"].
|
|
171
|
+
msg = await self.execute_requests[msg_id]["shell"].receive()
|
|
160
172
|
if scope.cancelled_caught:
|
|
161
173
|
del self.execute_requests[msg_id]
|
|
162
174
|
error_message = f"Kernel didn't respond in {timeout} seconds"
|
txl_kernel-0.3.8/pyproject.toml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = [ "hatchling",]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "txl_kernel"
|
|
7
|
-
version = "0.3.8"
|
|
8
|
-
description = "TXL plugin for a kernel driver"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
11
|
-
license = "MIT"
|
|
12
|
-
keywords = []
|
|
13
|
-
classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy",]
|
|
14
|
-
dependencies = [ "txl ==0.3.2", "python-dateutil >=2.8.2", "pycrdt >=0.10.9,<0.13.0",]
|
|
15
|
-
[[project.authors]]
|
|
16
|
-
name = "David Brochart"
|
|
17
|
-
email = "david.brochart@gmail.com"
|
|
18
|
-
|
|
19
|
-
[project.urls]
|
|
20
|
-
Source = "https://github.com/davidbrochart/jpterm/plugins/kernel"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|