txl-remote-kernels 0.2.15__tar.gz → 0.3.4__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.
Potentially problematic release.
This version of txl-remote-kernels might be problematic. Click here for more details.
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/PKG-INFO +6 -5
- txl_remote_kernels-0.3.4/pyproject.toml +28 -0
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/txl_remote_kernels/driver.py +9 -6
- txl_remote_kernels-0.2.15/txl_remote_kernels/components.py → txl_remote_kernels-0.3.4/txl_remote_kernels/main.py +26 -21
- txl_remote_kernels-0.2.15/pyproject.toml +0 -39
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/.gitignore +0 -0
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/LICENSE.txt +0 -0
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/README.md +0 -0
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/txl_remote_kernels/__init__.py +0 -0
- {txl_remote_kernels-0.2.15 → txl_remote_kernels-0.3.4}/txl_remote_kernels/message.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: txl_remote_kernels
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: TXL plugin for remote kernels
|
|
5
5
|
Project-URL: Source, https://github.com/davidbrochart/jpterm/plugins/remote_kernels
|
|
6
6
|
Author-email: David Brochart <david.brochart@gmail.com>
|
|
7
|
-
License: MIT
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.txt
|
|
8
9
|
Classifier: Development Status :: 4 - Beta
|
|
9
10
|
Classifier: Programming Language :: Python
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -16,9 +17,9 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
16
17
|
Requires-Python: >=3.10
|
|
17
18
|
Requires-Dist: httpx-ws>=0.4.2
|
|
18
19
|
Requires-Dist: httpx>=0.23.1
|
|
19
|
-
Requires-Dist: pycrdt<0.
|
|
20
|
+
Requires-Dist: pycrdt<0.13.0,>=0.10.9
|
|
20
21
|
Requires-Dist: txl-kernel
|
|
21
|
-
Requires-Dist: txl
|
|
22
|
+
Requires-Dist: txl==0.3.1
|
|
22
23
|
Description-Content-Type: text/markdown
|
|
23
24
|
|
|
24
25
|
# TXL plugin for remote kernels
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [ "hatchling",]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "txl_remote_kernels"
|
|
7
|
+
version = "0.3.4"
|
|
8
|
+
description = "TXL plugin for remote kernels"
|
|
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.1", "txl_kernel", "httpx >=0.23.1", "httpx-ws >=0.4.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/remote_kernels"
|
|
21
|
+
|
|
22
|
+
[project.entry-points."fps.modules"]
|
|
23
|
+
remote_kernels = "txl_remote_kernels.main:RemoteKernelsModule"
|
|
24
|
+
remote_kernelspecs = "txl_remote_kernels.main:RemoteKernelspecsModule"
|
|
25
|
+
|
|
26
|
+
[project.entry-points."txl.modules"]
|
|
27
|
+
remote_kernels = "txl_remote_kernels.main:RemoteKernelsModule"
|
|
28
|
+
remote_kernelspecs = "txl_remote_kernels.main:RemoteKernelspecsModule"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import asyncio
|
|
2
1
|
import json
|
|
3
2
|
import time
|
|
4
3
|
import uuid
|
|
@@ -6,6 +5,8 @@ from typing import Any, Dict
|
|
|
6
5
|
from urllib import parse
|
|
7
6
|
|
|
8
7
|
import httpx
|
|
8
|
+
from anyio import Lock, sleep
|
|
9
|
+
from anyioutils import create_task
|
|
9
10
|
from httpx_ws import aconnect_ws
|
|
10
11
|
from txl_kernel.driver import KernelMixin
|
|
11
12
|
from txl_kernel.message import date_to_str
|
|
@@ -25,11 +26,13 @@ def deadline_to_timeout(deadline: float) -> float:
|
|
|
25
26
|
class KernelDriver(KernelMixin):
|
|
26
27
|
def __init__(
|
|
27
28
|
self,
|
|
29
|
+
task_group,
|
|
28
30
|
url: str,
|
|
29
31
|
kernel_name: str | None = "",
|
|
30
32
|
comm_handlers=[],
|
|
31
33
|
) -> None:
|
|
32
|
-
super().__init__()
|
|
34
|
+
super().__init__(task_group)
|
|
35
|
+
self.task_group = task_group
|
|
33
36
|
self.kernel_name = kernel_name
|
|
34
37
|
parsed_url = parse.urlparse(url)
|
|
35
38
|
self.base_url = parse.urljoin(url, parsed_url.path).rstrip("/")
|
|
@@ -37,12 +40,12 @@ class KernelDriver(KernelMixin):
|
|
|
37
40
|
self.cookies = httpx.Cookies()
|
|
38
41
|
i = self.base_url.find(":")
|
|
39
42
|
self.ws_url = ("wss" if self.base_url[i - 1] == "s" else "ws") + self.base_url[i:]
|
|
40
|
-
self.start_task =
|
|
43
|
+
self.start_task = create_task(self.start(), task_group)
|
|
41
44
|
self.comm_handlers = comm_handlers
|
|
42
45
|
self.shell_channel = "shell"
|
|
43
46
|
self.control_channel = "control"
|
|
44
47
|
self.iopub_channel = "iopub"
|
|
45
|
-
self.send_lock =
|
|
48
|
+
self.send_lock = Lock()
|
|
46
49
|
self.kernel_id = None
|
|
47
50
|
|
|
48
51
|
async def start(self):
|
|
@@ -76,11 +79,11 @@ class KernelDriver(KernelMixin):
|
|
|
76
79
|
cookies=self.cookies,
|
|
77
80
|
subprotocols=["v1.kernel.websocket.jupyter.org"],
|
|
78
81
|
) as self.websocket:
|
|
79
|
-
recv_task =
|
|
82
|
+
recv_task = create_task(self._recv(), self.task_group)
|
|
80
83
|
try:
|
|
81
84
|
await self.wait_for_ready()
|
|
82
85
|
self.started.set()
|
|
83
|
-
await
|
|
86
|
+
await sleep(float("inf"))
|
|
84
87
|
except BaseException:
|
|
85
88
|
recv_task.cancel()
|
|
86
89
|
self.start_task.cancel()
|
|
@@ -4,7 +4,8 @@ from typing import Any
|
|
|
4
4
|
from urllib import parse
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
from
|
|
7
|
+
from anyio import create_task_group, sleep
|
|
8
|
+
from fps import Module
|
|
8
9
|
from pycrdt import Map
|
|
9
10
|
|
|
10
11
|
from txl.base import Kernels, Kernelspecs
|
|
@@ -20,7 +21,9 @@ class RemoteKernels(Kernels):
|
|
|
20
21
|
url: str,
|
|
21
22
|
kernel_name: str | None,
|
|
22
23
|
):
|
|
23
|
-
self.kernel = KernelDriver(
|
|
24
|
+
self.kernel = KernelDriver(
|
|
25
|
+
self.task_group, url, kernel_name, comm_handlers=self.comm_handlers
|
|
26
|
+
)
|
|
24
27
|
|
|
25
28
|
async def execute(self, ycell: Map):
|
|
26
29
|
await self.kernel.execute(ycell)
|
|
@@ -52,32 +55,34 @@ class RemoteKernelspecs(Kernelspecs):
|
|
|
52
55
|
raise RuntimeError(f"Could not connect to a Jupyter server at {url}")
|
|
53
56
|
|
|
54
57
|
|
|
55
|
-
class
|
|
56
|
-
def __init__(self, url: str = "http://127.0.0.1:8000"):
|
|
57
|
-
super().__init__()
|
|
58
|
+
class RemoteKernelsModule(Module):
|
|
59
|
+
def __init__(self, name: str, url: str = "http://127.0.0.1:8000"):
|
|
60
|
+
super().__init__(name)
|
|
58
61
|
self.url = url
|
|
59
62
|
|
|
60
|
-
async def start(
|
|
61
|
-
self,
|
|
62
|
-
ctx: Context,
|
|
63
|
-
) -> None:
|
|
63
|
+
async def start(self) -> None:
|
|
64
64
|
url = self.url
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
async with create_task_group() as self.tg:
|
|
67
|
+
class _RemoteKernels(RemoteKernels):
|
|
68
|
+
task_group = self.tg
|
|
69
|
+
|
|
70
|
+
def __init__(self, *args, **kwargs):
|
|
71
|
+
super().__init__(url, *args, **kwargs)
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
self.put(_RemoteKernels, Kernels)
|
|
74
|
+
self.done()
|
|
75
|
+
await sleep(float("inf"))
|
|
71
76
|
|
|
77
|
+
async def stop(self) -> None:
|
|
78
|
+
self.tg.cancel_scope.cancel()
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
|
|
81
|
+
class RemoteKernelspecsModule(Module):
|
|
82
|
+
def __init__(self, name: str, url: str = "http://127.0.0.1:8000"):
|
|
83
|
+
super().__init__(name)
|
|
76
84
|
self.url = url
|
|
77
85
|
|
|
78
|
-
async def start(
|
|
79
|
-
self,
|
|
80
|
-
ctx: Context,
|
|
81
|
-
) -> None:
|
|
86
|
+
async def start(self) -> None:
|
|
82
87
|
kernelspecs = RemoteKernelspecs(self.url)
|
|
83
|
-
|
|
88
|
+
self.put(kernelspecs, Kernelspecs)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "txl_remote_kernels"
|
|
7
|
-
version = "0.2.15"
|
|
8
|
-
description = "TXL plugin for remote kernels"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
11
|
-
license = "MIT"
|
|
12
|
-
keywords = []
|
|
13
|
-
authors = [
|
|
14
|
-
{ name = "David Brochart", email = "david.brochart@gmail.com" },
|
|
15
|
-
]
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Development Status :: 4 - Beta",
|
|
18
|
-
"Programming Language :: Python",
|
|
19
|
-
"Programming Language :: Python :: 3.10",
|
|
20
|
-
"Programming Language :: Python :: 3.11",
|
|
21
|
-
"Programming Language :: Python :: 3.12",
|
|
22
|
-
"Programming Language :: Python :: 3.13",
|
|
23
|
-
"Programming Language :: Python :: Implementation :: CPython",
|
|
24
|
-
"Programming Language :: Python :: Implementation :: PyPy",
|
|
25
|
-
]
|
|
26
|
-
dependencies = [
|
|
27
|
-
"txl >=0.2.18,<0.3.0",
|
|
28
|
-
"txl_kernel",
|
|
29
|
-
"httpx >=0.23.1",
|
|
30
|
-
"httpx-ws >=0.4.2",
|
|
31
|
-
"pycrdt >=0.10.9,<0.11.0",
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
[project.urls]
|
|
35
|
-
Source = "https://github.com/davidbrochart/jpterm/plugins/remote_kernels"
|
|
36
|
-
|
|
37
|
-
[project.entry-points]
|
|
38
|
-
"asphalt.components" = {remote_kernels = "txl_remote_kernels.components:RemoteKernelsComponent", remote_kernelspecs = "txl_remote_kernels.components:RemoteKernelspecsComponent"}
|
|
39
|
-
"txl.components" = {remote_kernels = "txl_remote_kernels.components:RemoteKernelsComponent", remote_kernelspecs = "txl_remote_kernels.components:RemoteKernelspecsComponent"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|