satori-python-server 0.11.0__tar.gz → 0.11.2__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.
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/.mina/server.toml +2 -1
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/PKG-INFO +3 -2
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/pyproject.toml +3 -2
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/src/satori/server/__init__.py +24 -3
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/LICENSE +0 -0
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/README.md +0 -0
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/src/satori/server/adapter.py +0 -0
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/src/satori/server/conection.py +0 -0
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/src/satori/server/model.py +0 -0
- {satori_python_server-0.11.0 → satori_python_server-0.11.2}/src/satori/server/route.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
includes = ["src/satori/server"]
|
|
2
|
-
raw-dependencies = ["satori-python-core >= 0.11.
|
|
2
|
+
raw-dependencies = ["satori-python-core >= 0.11.2"]
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "satori-python-server"
|
|
@@ -8,6 +8,7 @@ authors = [
|
|
|
8
8
|
{name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}
|
|
9
9
|
]
|
|
10
10
|
dependencies = [
|
|
11
|
+
"aiohttp",
|
|
11
12
|
"launart",
|
|
12
13
|
"graia-amnesia",
|
|
13
14
|
"starlette",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: satori-python-server
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: Satori Protocol SDK for python, specify server part
|
|
5
5
|
Home-page: https://github.com/RF-Tar-Railt/satori-python
|
|
6
6
|
Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
|
|
@@ -17,11 +17,12 @@ Classifier: Operating System :: OS Independent
|
|
|
17
17
|
Project-URL: Homepage, https://github.com/RF-Tar-Railt/satori-python
|
|
18
18
|
Project-URL: Repository, https://github.com/RF-Tar-Railt/satori-python
|
|
19
19
|
Requires-Python: >=3.8
|
|
20
|
+
Requires-Dist: aiohttp>=3.9.3
|
|
20
21
|
Requires-Dist: launart>=0.8.2
|
|
21
22
|
Requires-Dist: graia-amnesia>=0.9.0
|
|
22
23
|
Requires-Dist: starlette>=0.37.2
|
|
23
24
|
Requires-Dist: uvicorn[standard]>=0.28.0
|
|
24
|
-
Requires-Dist: satori-python-core>=0.11.
|
|
25
|
+
Requires-Dist: satori-python-core>=0.11.2
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
26
27
|
|
|
27
28
|
# satori-python
|
|
@@ -5,11 +5,12 @@ authors = [
|
|
|
5
5
|
{ name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com" },
|
|
6
6
|
]
|
|
7
7
|
dependencies = [
|
|
8
|
+
"aiohttp>=3.9.3",
|
|
8
9
|
"launart>=0.8.2",
|
|
9
10
|
"graia-amnesia>=0.9.0",
|
|
10
11
|
"starlette>=0.37.2",
|
|
11
12
|
"uvicorn[standard]>=0.28.0",
|
|
12
|
-
"satori-python-core >= 0.11.
|
|
13
|
+
"satori-python-core >= 0.11.2",
|
|
13
14
|
]
|
|
14
15
|
description = "Satori Protocol SDK for python, specify server part"
|
|
15
16
|
readme = "README.md"
|
|
@@ -25,7 +26,7 @@ classifiers = [
|
|
|
25
26
|
"Programming Language :: Python :: 3.12",
|
|
26
27
|
"Operating System :: OS Independent",
|
|
27
28
|
]
|
|
28
|
-
version = "0.11.
|
|
29
|
+
version = "0.11.2"
|
|
29
30
|
|
|
30
31
|
[project.license]
|
|
31
32
|
text = "MIT"
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
|
+
import functools
|
|
4
5
|
import signal
|
|
6
|
+
import threading
|
|
5
7
|
from contextlib import suppress
|
|
6
8
|
from traceback import print_exc
|
|
7
|
-
from typing import Callable, Iterable, Literal, cast, overload
|
|
9
|
+
from typing import Any, Callable, Iterable, Literal, cast, overload
|
|
8
10
|
|
|
9
11
|
import aiohttp
|
|
10
12
|
from creart import it
|
|
@@ -383,8 +385,27 @@ class Server(Service):
|
|
|
383
385
|
manager.add_component(self)
|
|
384
386
|
manager.launch_blocking(loop=loop, stop_signal=stop_signal)
|
|
385
387
|
|
|
386
|
-
async def run_async(
|
|
388
|
+
async def run_async(
|
|
389
|
+
self,
|
|
390
|
+
manager: Launart | None = None,
|
|
391
|
+
stop_signal: Iterable[signal.Signals] = (signal.SIGINT,),
|
|
392
|
+
):
|
|
387
393
|
if manager is None:
|
|
388
394
|
manager = it(Launart)
|
|
389
395
|
manager.add_component(self)
|
|
390
|
-
|
|
396
|
+
handled_signals: dict[signal.Signals, Any] = {}
|
|
397
|
+
launch_task = asyncio.create_task(manager.launch(), name="amnesia-launch")
|
|
398
|
+
signal_handler = functools.partial(manager._on_sys_signal, main_task=launch_task)
|
|
399
|
+
if threading.current_thread() is threading.main_thread(): # pragma: worst case
|
|
400
|
+
try:
|
|
401
|
+
for sig in stop_signal:
|
|
402
|
+
handled_signals[sig] = signal.getsignal(sig)
|
|
403
|
+
signal.signal(sig, signal_handler)
|
|
404
|
+
except ValueError: # pragma: no cover
|
|
405
|
+
# `signal.signal` may throw if `threading.main_thread` does
|
|
406
|
+
# not support signals
|
|
407
|
+
handled_signals.clear()
|
|
408
|
+
await launch_task
|
|
409
|
+
for sig, handler in handled_signals.items():
|
|
410
|
+
if signal.getsignal(sig) is signal_handler:
|
|
411
|
+
signal.signal(sig, handler)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|