fps_akernel_task 0.1.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.
- fps_akernel_task-0.1.0/LICENSE +21 -0
- fps_akernel_task-0.1.0/PKG-INFO +17 -0
- fps_akernel_task-0.1.0/README.md +3 -0
- fps_akernel_task-0.1.0/fps_akernel_task/__init__.py +6 -0
- fps_akernel_task-0.1.0/fps_akernel_task/akernel_task.py +49 -0
- fps_akernel_task-0.1.0/fps_akernel_task/main.py +14 -0
- fps_akernel_task-0.1.0/fps_akernel_task/py.typed +0 -0
- fps_akernel_task-0.1.0/pyproject.toml +32 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Brochart
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fps_akernel_task
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An FPS plugin for the kernel task API
|
|
5
|
+
Project-URL: Homepage, https://github.com/davidbrochart/akernel
|
|
6
|
+
Author-email: David Brochart <david.brochart@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: fastapi,jupyter,plugins,server
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: anyio
|
|
12
|
+
Requires-Dist: jupyverse-api<0.11.0,>=0.10.0
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# fps-akernel-task
|
|
16
|
+
|
|
17
|
+
An FPS plugin for the kernel task API.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from anyio import TASK_STATUS_IGNORED, create_task_group, sleep_forever
|
|
4
|
+
from anyio.abc import TaskStatus
|
|
5
|
+
from jupyverse_api.kernel import Kernel as _Kernel
|
|
6
|
+
|
|
7
|
+
from akernel.kernel import Kernel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AKernelTask(_Kernel):
|
|
11
|
+
def __init__(self, *args, **kwargs):
|
|
12
|
+
super().__init__()
|
|
13
|
+
|
|
14
|
+
async def start(self, *, task_status: TaskStatus[None] = TASK_STATUS_IGNORED) -> None:
|
|
15
|
+
async with (
|
|
16
|
+
create_task_group() as self.task_group,
|
|
17
|
+
self._to_shell_send_stream,
|
|
18
|
+
self._to_shell_receive_stream,
|
|
19
|
+
self._from_shell_send_stream,
|
|
20
|
+
self._from_shell_receive_stream,
|
|
21
|
+
self._to_control_send_stream,
|
|
22
|
+
self._to_control_receive_stream,
|
|
23
|
+
self._from_control_send_stream,
|
|
24
|
+
self._from_control_receive_stream,
|
|
25
|
+
self._to_stdin_send_stream,
|
|
26
|
+
self._to_stdin_receive_stream,
|
|
27
|
+
self._from_stdin_send_stream,
|
|
28
|
+
self._from_stdin_receive_stream,
|
|
29
|
+
self._from_iopub_send_stream,
|
|
30
|
+
self._from_iopub_receive_stream,
|
|
31
|
+
):
|
|
32
|
+
self.kernel = Kernel(
|
|
33
|
+
self._to_shell_receive_stream,
|
|
34
|
+
self._from_shell_send_stream,
|
|
35
|
+
self._to_control_receive_stream,
|
|
36
|
+
self._from_control_send_stream,
|
|
37
|
+
self._to_stdin_receive_stream,
|
|
38
|
+
self._from_stdin_send_stream,
|
|
39
|
+
self._from_iopub_send_stream,
|
|
40
|
+
)
|
|
41
|
+
self.task_group.start_soon(self.kernel.start)
|
|
42
|
+
task_status.started()
|
|
43
|
+
await sleep_forever()
|
|
44
|
+
|
|
45
|
+
async def stop(self) -> None:
|
|
46
|
+
self.task_group.cancel_scope.cancel()
|
|
47
|
+
|
|
48
|
+
async def interrupt(self) -> None:
|
|
49
|
+
pass
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from fps import Module
|
|
4
|
+
|
|
5
|
+
from jupyverse_api.kernel import KernelFactory
|
|
6
|
+
from jupyverse_api.kernels import Kernels
|
|
7
|
+
|
|
8
|
+
from .akernel_task import AKernelTask
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AKernelTaskModule(Module):
|
|
12
|
+
async def prepare(self) -> None:
|
|
13
|
+
kernels = await self.get(Kernels)
|
|
14
|
+
kernels.register_kernel_factory("akernel", KernelFactory(AKernelTask))
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fps_akernel_task"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "An FPS plugin for the kernel task API"
|
|
9
|
+
keywords = ["jupyter", "server", "fastapi", "plugins"]
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"jupyverse-api >=0.10.0,<0.11.0",
|
|
13
|
+
"anyio",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[[project.authors]]
|
|
17
|
+
name = "David Brochart"
|
|
18
|
+
email = "david.brochart@gmail.com"
|
|
19
|
+
|
|
20
|
+
[project.readme]
|
|
21
|
+
file = "README.md"
|
|
22
|
+
content-type = "text/markdown"
|
|
23
|
+
|
|
24
|
+
[project.license]
|
|
25
|
+
text = "MIT"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/davidbrochart/akernel"
|
|
29
|
+
|
|
30
|
+
[project.entry-points]
|
|
31
|
+
"fps.modules" = {akernel_task = "fps_akernel_task.main:AKernelTaskModule"}
|
|
32
|
+
"jupyverse.modules" = {akernel_task = "fps_akernel_task.main:AKernelTaskModule"}
|