tigrcorn-runtime 0.3.16.dev5__py3-none-any.whl

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.
@@ -0,0 +1,12 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ from contextlib import suppress
5
+
6
+
7
+ async def graceful_cancel(task: asyncio.Task | None) -> None:
8
+ if task is None:
9
+ return
10
+ task.cancel()
11
+ with suppress(asyncio.CancelledError):
12
+ await task
@@ -0,0 +1,33 @@
1
+ from __future__ import annotations
2
+
3
+ import signal
4
+ from collections.abc import Callable
5
+ from types import FrameType
6
+ from typing import Any
7
+
8
+
9
+ SignalCallback = Callable[[int], None]
10
+
11
+
12
+ def install_signal_handlers(loop: Any, callback: Callable[[], None]) -> None:
13
+ for sig in (signal.SIGINT, signal.SIGTERM):
14
+ try:
15
+ loop.add_signal_handler(sig, callback)
16
+ except (NotImplementedError, RuntimeError): # pragma: no cover - platform dependent
17
+ try:
18
+ signal.signal(sig, lambda *_: callback())
19
+ except ValueError:
20
+ pass
21
+
22
+
23
+ def install_sync_signal_handlers(callback: SignalCallback) -> dict[int, Any]:
24
+ previous: dict[int, Any] = {}
25
+ for sig in (signal.SIGINT, signal.SIGTERM):
26
+ previous[sig] = signal.getsignal(sig)
27
+ signal.signal(sig, lambda signum, frame, cb=callback: cb(signum))
28
+ return previous
29
+
30
+
31
+ def restore_signal_handlers(previous: dict[int, Any]) -> None:
32
+ for sig, handler in previous.items():
33
+ signal.signal(sig, handler)
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from time import monotonic
5
+
6
+ from tigrcorn_observability.metrics import Metrics
7
+
8
+
9
+ @dataclass(slots=True)
10
+ class ServerState:
11
+ started_at: float = field(default_factory=monotonic)
12
+ metrics: Metrics = field(default_factory=Metrics)
13
+ shutting_down: bool = False
@@ -0,0 +1,110 @@
1
+ from __future__ import annotations
2
+
3
+ import contextlib
4
+ import os
5
+ import time
6
+ from dataclasses import dataclass, field
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ from tigrcorn_config.load import config_to_dict
11
+ from tigrcorn_config.model import ServerConfig
12
+ from tigrcorn_runtime.server.bootstrap import prebind_listener_sockets, run_worker_from_config_payload
13
+ from tigrcorn_runtime.server.signals import install_sync_signal_handlers, restore_signal_handlers
14
+ from tigrcorn_runtime.workers.process import ProcessWorker
15
+ from tigrcorn_runtime.workers.supervisor import WorkerSupervisor
16
+
17
+
18
+ @dataclass(slots=True)
19
+ class ServerSupervisor:
20
+ app_target: str | None
21
+ config: ServerConfig
22
+ started: bool = False
23
+ hooks: list[Any] = field(default_factory=list)
24
+ poll_interval: float = 0.2
25
+ bound_sockets: list[Any] = field(default_factory=list)
26
+ workers: WorkerSupervisor = field(default_factory=lambda: WorkerSupervisor(auto_restart=True))
27
+ _stopping: bool = False
28
+
29
+ def add_shutdown_hook(self, hook) -> None:
30
+ self.hooks.append(hook)
31
+
32
+ def request_shutdown(self) -> None:
33
+ self._stopping = True
34
+
35
+ def _worker_payload(self) -> dict[str, Any]:
36
+ payload = config_to_dict(self.config)
37
+ if self.app_target is not None:
38
+ payload.setdefault('app', {})['target'] = self.app_target
39
+ return payload
40
+
41
+ def _build_workers(self) -> None:
42
+ worker_count = max(1, self.config.process.workers)
43
+ payload = self._worker_payload()
44
+ for index in range(worker_count):
45
+ worker = ProcessWorker(name=f'tigrcorn-worker-{index}', healthcheck_timeout=self.config.process.worker_healthcheck_timeout)
46
+ worker.start(run_worker_from_config_payload, payload)
47
+ self.workers.add(worker)
48
+
49
+ def start(self) -> None:
50
+ if self.started:
51
+ return
52
+ self.bound_sockets = prebind_listener_sockets(self.config)
53
+ if self.config.process.pid_file:
54
+ Path(self.config.process.pid_file).write_text(str(os.getpid()))
55
+ self._build_workers()
56
+ self.started = True
57
+
58
+ def replace_worker(self, index: int) -> None:
59
+ payload = self._worker_payload()
60
+ worker = self.workers.workers[index]
61
+ replacement = ProcessWorker(name=f'{worker.name}-replacement', healthcheck_timeout=self.config.process.worker_healthcheck_timeout)
62
+ replacement.start(run_worker_from_config_payload, payload)
63
+ self.workers.replace(index, replacement)
64
+
65
+ def poll_workers_once(self) -> list[dict[str, Any]]:
66
+ restarted: list[dict[str, Any]] = []
67
+ payload = self._worker_payload()
68
+ for index, worker in enumerate(list(self.workers.workers)):
69
+ if not isinstance(worker, ProcessWorker):
70
+ continue
71
+ worker.poll_ready()
72
+ should_restart = worker.process is not None and not worker.is_alive()
73
+ if worker.startup_timed_out() and not self._stopping:
74
+ worker.stop(timeout=min(5.0, self.config.process.worker_healthcheck_timeout))
75
+ should_restart = True
76
+ if should_restart and not self._stopping:
77
+ worker.restart_count += 1
78
+ replacement = ProcessWorker(name=worker.name, healthcheck_timeout=self.config.process.worker_healthcheck_timeout)
79
+ replacement.start(run_worker_from_config_payload, payload)
80
+ self.workers.workers[index] = replacement
81
+ restarted.append({'index': index, 'name': replacement.name, 'ready': replacement.ready})
82
+ return restarted
83
+
84
+ def stop(self) -> None:
85
+ self._stopping = True
86
+ self.workers.stop_all(timeout=self.config.http.shutdown_timeout)
87
+ for hook in self.hooks:
88
+ try:
89
+ hook()
90
+ except Exception:
91
+ pass
92
+ for sock in self.bound_sockets:
93
+ try:
94
+ sock.close()
95
+ except Exception:
96
+ pass
97
+ if self.config.process.pid_file:
98
+ with contextlib.suppress(Exception):
99
+ Path(self.config.process.pid_file).unlink()
100
+
101
+ def run(self) -> None:
102
+ self.start()
103
+ previous = install_sync_signal_handlers(lambda _sig: self.request_shutdown())
104
+ try:
105
+ while not self._stopping:
106
+ self.poll_workers_once()
107
+ time.sleep(self.poll_interval)
108
+ finally:
109
+ restore_signal_handlers(previous)
110
+ self.stop()
@@ -0,0 +1,6 @@
1
+ from .local import LocalWorker
2
+ from .model import WorkerConfig
3
+ from .process import ProcessWorker
4
+ from .supervisor import WorkerSupervisor
5
+
6
+ __all__ = ["LocalWorker", "ProcessWorker", "WorkerConfig", "WorkerSupervisor"]
@@ -0,0 +1,36 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from time import monotonic
5
+ from typing import Any, Callable
6
+
7
+
8
+ @dataclass(slots=True)
9
+ class LocalWorker:
10
+ name: str = 'local'
11
+ running: bool = False
12
+ metadata: dict[str, Any] = field(default_factory=dict)
13
+ start_count: int = 0
14
+ stop_count: int = 0
15
+ last_started_at: float | None = None
16
+ callback: Callable[[], None] | None = None
17
+
18
+ def start(self) -> None:
19
+ self.running = True
20
+ self.start_count += 1
21
+ self.last_started_at = monotonic()
22
+ if self.callback is not None:
23
+ self.callback()
24
+
25
+ def stop(self) -> None:
26
+ self.running = False
27
+ self.stop_count += 1
28
+
29
+ def health(self) -> dict[str, Any]:
30
+ return {
31
+ 'name': self.name,
32
+ 'alive': self.running,
33
+ 'start_count': self.start_count,
34
+ 'stop_count': self.stop_count,
35
+ 'last_started_at': self.last_started_at,
36
+ }
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+
6
+ @dataclass(slots=True)
7
+ class WorkerConfig:
8
+ processes: int = 1
9
+ graceful_shutdown_timeout: float = 30.0
@@ -0,0 +1,120 @@
1
+ from __future__ import annotations
2
+
3
+ import multiprocessing
4
+ import os
5
+ import signal
6
+ from dataclasses import dataclass, field
7
+ from time import monotonic
8
+ from typing import Any, Callable
9
+
10
+
11
+ @dataclass(slots=True)
12
+ class ProcessWorker:
13
+ name: str = 'process'
14
+ process: multiprocessing.Process | None = None
15
+ target: Callable[..., None] | None = None
16
+ args: tuple[Any, ...] = field(default_factory=tuple)
17
+ kwargs: dict[str, Any] = field(default_factory=dict)
18
+ start_count: int = 0
19
+ restart_count: int = 0
20
+ last_started_at: float | None = None
21
+ healthcheck_timeout: float = 30.0
22
+ ready: bool = False
23
+ ready_at: float | None = None
24
+ _ready_parent: Any | None = None
25
+
26
+ def _ctx(self) -> multiprocessing.context.BaseContext:
27
+ if os.name == 'posix':
28
+ try:
29
+ return multiprocessing.get_context('fork')
30
+ except ValueError:
31
+ pass
32
+ return multiprocessing.get_context()
33
+
34
+ def start(self, target: Callable[..., None] | None = None, *args: Any, **kwargs: Any) -> None:
35
+ if target is not None:
36
+ self.target = target
37
+ self.args = args
38
+ self.kwargs = kwargs
39
+ if self.target is None:
40
+ raise RuntimeError('process worker target is not configured')
41
+ if self.process is not None and self.process.is_alive():
42
+ return
43
+ ctx = self._ctx()
44
+ parent_ready, child_ready = ctx.Pipe(duplex=False)
45
+ child_kwargs = dict(self.kwargs)
46
+ child_kwargs['ready_pipe'] = child_ready
47
+ self.process = ctx.Process(target=self.target, args=self.args, kwargs=child_kwargs, name=self.name)
48
+ self.process.start()
49
+ self._ready_parent = parent_ready
50
+ self.ready = False
51
+ self.ready_at = None
52
+ self.start_count += 1
53
+ self.last_started_at = monotonic()
54
+
55
+ def poll_ready(self) -> None:
56
+ if self.ready or self._ready_parent is None:
57
+ return
58
+ try:
59
+ if self._ready_parent.poll():
60
+ self._ready_parent.recv()
61
+ self.ready = True
62
+ self.ready_at = monotonic()
63
+ except EOFError:
64
+ self._ready_parent = None
65
+
66
+ def startup_timed_out(self) -> bool:
67
+ self.poll_ready()
68
+ if self.ready or self.healthcheck_timeout <= 0 or self.last_started_at is None:
69
+ return False
70
+ return (monotonic() - self.last_started_at) > self.healthcheck_timeout
71
+
72
+ def stop(self, timeout: float = 5.0) -> None:
73
+ if self.process is None:
74
+ return
75
+ if self.process.is_alive():
76
+ try:
77
+ self.process.terminate()
78
+ except Exception:
79
+ pass
80
+ self.process.join(timeout=timeout)
81
+ if self.process.is_alive():
82
+ try:
83
+ os.kill(self.process.pid, signal.SIGKILL)
84
+ except Exception:
85
+ pass
86
+ self.process.join(timeout=1.0)
87
+ if self._ready_parent is not None:
88
+ try:
89
+ self._ready_parent.close()
90
+ except Exception:
91
+ pass
92
+ self._ready_parent = None
93
+ self.ready = False
94
+ self.ready_at = None
95
+
96
+ def restart(self, timeout: float = 5.0) -> None:
97
+ self.restart_count += 1
98
+ target = self.target
99
+ args = self.args
100
+ kwargs = dict(self.kwargs)
101
+ self.stop(timeout=timeout)
102
+ self.start(target, *args, **kwargs)
103
+
104
+ def is_alive(self) -> bool:
105
+ return bool(self.process is not None and self.process.is_alive())
106
+
107
+ def health(self) -> dict[str, Any]:
108
+ self.poll_ready()
109
+ return {
110
+ 'name': self.name,
111
+ 'pid': self.process.pid if self.process else None,
112
+ 'alive': self.is_alive(),
113
+ 'ready': self.ready,
114
+ 'exitcode': self.process.exitcode if self.process else None,
115
+ 'start_count': self.start_count,
116
+ 'restart_count': self.restart_count,
117
+ 'last_started_at': self.last_started_at,
118
+ 'ready_at': self.ready_at,
119
+ 'startup_timed_out': self.startup_timed_out(),
120
+ }
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import Any
5
+
6
+ from .local import LocalWorker
7
+ from .process import ProcessWorker
8
+
9
+ WorkerType = LocalWorker | ProcessWorker
10
+
11
+
12
+ @dataclass(slots=True)
13
+ class WorkerSupervisor:
14
+ workers: list[WorkerType] = field(default_factory=list)
15
+ auto_restart: bool = True
16
+
17
+ def add(self, worker: WorkerType) -> None:
18
+ self.workers.append(worker)
19
+
20
+ def start_all(self) -> None:
21
+ for worker in self.workers:
22
+ worker.start() # type: ignore[arg-type]
23
+
24
+ def stop_all(self, *, timeout: float = 5.0) -> None:
25
+ for worker in self.workers:
26
+ if isinstance(worker, ProcessWorker):
27
+ worker.stop(timeout=timeout)
28
+ else:
29
+ worker.stop()
30
+
31
+ def replace(self, index: int, worker: WorkerType | None = None, *, timeout: float = 5.0) -> WorkerType:
32
+ current = self.workers[index]
33
+ replacement = worker or current
34
+ if replacement is current:
35
+ if isinstance(current, ProcessWorker):
36
+ current.restart(timeout=timeout)
37
+ else:
38
+ current.stop()
39
+ current.start()
40
+ return current
41
+ if isinstance(current, ProcessWorker):
42
+ current.stop(timeout=timeout)
43
+ else:
44
+ current.stop()
45
+ self.workers[index] = replacement
46
+ replacement.start() # type: ignore[arg-type]
47
+ return replacement
48
+
49
+ def unhealthy(self) -> list[WorkerType]:
50
+ unhealthy: list[WorkerType] = []
51
+ for worker in self.workers:
52
+ if isinstance(worker, ProcessWorker):
53
+ if worker.process is not None and not worker.is_alive() and worker.process.exitcode not in (None, 0):
54
+ unhealthy.append(worker)
55
+ return unhealthy
56
+
57
+ def snapshot(self) -> list[dict[str, Any]]:
58
+ return [worker.health() for worker in self.workers]
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.4
2
+ Name: tigrcorn-runtime
3
+ Version: 0.3.16.dev5
4
+ Summary: Server runner, app loading, lifecycle hooks, workers, reload, and embedded runtime for the Tigrcorn ASGI3 web server.
5
+ Author-email: Jacob Stewart <jacob@swarmauri.com>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction, and
15
+ distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by the
18
+ copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all other
21
+ entities that control, are controlled by, or are under common control with
22
+ that entity. For the purposes of this definition, "control" means (i) the
23
+ power, direct or indirect, to cause the direction or management of such
24
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
25
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
26
+ such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
29
+ permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation source, and
33
+ configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical transformation
36
+ or translation of a Source form, including but not limited to compiled object
37
+ code, generated documentation, and conversions to other media types.
38
+
39
+ "Work" shall mean the work of authorship, whether in Source or Object form,
40
+ made available under the License, as indicated by a copyright notice that is
41
+ included in or attached to the work (an example is provided in the Appendix
42
+ below).
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object form,
45
+ that is based on (or derived from) the Work and for which the editorial
46
+ revisions, annotations, elaborations, or other modifications represent, as a
47
+ whole, an original work of authorship. For the purposes of this License,
48
+ Derivative Works shall not include works that remain separable from, or
49
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
50
+ Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including the original
53
+ version of the Work and any modifications or additions to that Work or
54
+ Derivative Works thereof, that is intentionally submitted to Licensor for
55
+ inclusion in the Work by the copyright owner or by an individual or Legal
56
+ Entity authorized to submit on behalf of the copyright owner. For the
57
+ purposes of this definition, "submitted" means any form of electronic,
58
+ verbal, or written communication sent to the Licensor or its representatives,
59
+ including but not limited to communication on electronic mailing lists,
60
+ source code control systems, and issue tracking systems that are managed by,
61
+ or on behalf of, the Licensor for the purpose of discussing and improving the
62
+ Work, but excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
66
+ behalf of whom a Contribution has been received by Licensor and subsequently
67
+ incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
70
+ License, each Contributor hereby grants to You a perpetual, worldwide,
71
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
72
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
73
+ sublicense, and distribute the Work and such Derivative Works in Source or
74
+ Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of this
77
+ License, each Contributor hereby grants to You a perpetual, worldwide,
78
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
79
+ section) patent license to make, have made, use, offer to sell, sell, import,
80
+ and otherwise transfer the Work, where such license applies only to those
81
+ patent claims licensable by such Contributor that are necessarily infringed by
82
+ their Contribution(s) alone or by combination of their Contribution(s) with
83
+ the Work to which such Contribution(s) was submitted. If You institute patent
84
+ litigation against any entity (including a cross-claim or counterclaim in a
85
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
86
+ constitutes direct or contributory patent infringement, then any patent
87
+ licenses granted to You under this License for that Work shall terminate as of
88
+ the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
91
+ Derivative Works thereof in any medium, with or without modifications, and in
92
+ Source or Object form, provided that You meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative Works a copy
95
+ of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices stating that
98
+ You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works that You
101
+ distribute, all copyright, patent, trademark, and attribution notices
102
+ from the Source form of the Work, excluding those notices that do not
103
+ pertain to any part of the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
106
+ then any Derivative Works that You distribute must include a readable copy
107
+ of the attribution notices contained within such NOTICE file, excluding
108
+ those notices that do not pertain to any part of the Derivative Works, in
109
+ at least one of the following places: within a NOTICE text file distributed
110
+ as part of the Derivative Works; within the Source form or documentation,
111
+ if provided along with the Derivative Works; or, within a display generated
112
+ by the Derivative Works, if and wherever such third-party notices normally
113
+ appear. The contents of the NOTICE file are for informational purposes only
114
+ and do not modify the License. You may add Your own attribution notices
115
+ within Derivative Works that You distribute, alongside or as an addendum to
116
+ the NOTICE text from the Work, provided that such additional attribution
117
+ notices cannot be construed as modifying the License.
118
+
119
+ You may add Your own copyright statement to Your modifications and may provide
120
+ additional or different license terms and conditions for use, reproduction, or
121
+ distribution of Your modifications, or for any such Derivative Works as a
122
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
123
+ complies with the conditions stated in this License.
124
+
125
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
126
+ Contribution intentionally submitted for inclusion in the Work by You to the
127
+ Licensor shall be under the terms and conditions of this License, without any
128
+ additional terms or conditions. Notwithstanding the above, nothing herein
129
+ shall supersede or modify the terms of any separate license agreement you may
130
+ have executed with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade names,
133
+ trademarks, service marks, or product names of the Licensor, except as
134
+ required for reasonable and customary use in describing the origin of the Work
135
+ and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
138
+ writing, Licensor provides the Work (and each Contributor provides its
139
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
140
+ KIND, either express or implied, including, without limitation, any warranties
141
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or redistributing the Work and assume any risks
144
+ associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
147
+ tort (including negligence), contract, or otherwise, unless required by
148
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
149
+ writing, shall any Contributor be liable to You for damages, including any
150
+ direct, indirect, special, incidental, or consequential damages of any
151
+ character arising as a result of this License or out of the use or inability
152
+ to use the Work (including but not limited to damages for loss of goodwill,
153
+ work stoppage, computer failure or malfunction, or any and all other
154
+ commercial damages or losses), even if such Contributor has been advised of
155
+ the possibility of such damages.
156
+
157
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
158
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
159
+ acceptance of support, warranty, indemnity, or other liability obligations
160
+ and/or rights consistent with this License. However, in accepting such
161
+ obligations, You may act only on Your own behalf and on Your sole
162
+ responsibility, not on behalf of any other Contributor, and only if You agree
163
+ to indemnify, defend, and hold each Contributor harmless for any liability
164
+ incurred by, or claims asserted against, such Contributor by reason of your
165
+ accepting any such warranty or additional liability.
166
+
167
+ END OF TERMS AND CONDITIONS
168
+
169
+
170
+ Keywords: tigrcorn,asgi-server,server-runtime,lifespan,workers,reload,python-web-server
171
+ Classifier: Development Status :: 3 - Alpha
172
+ Classifier: Framework :: AsyncIO
173
+ Classifier: Intended Audience :: Developers
174
+ Classifier: License :: OSI Approved :: Apache Software License
175
+ Classifier: Operating System :: OS Independent
176
+ Classifier: Programming Language :: Python :: 3
177
+ Classifier: Programming Language :: Python :: 3 :: Only
178
+ Classifier: Programming Language :: Python :: 3.11
179
+ Classifier: Programming Language :: Python :: 3.12
180
+ Classifier: Programming Language :: Python :: 3.13
181
+ Classifier: Topic :: Internet :: WWW/HTTP
182
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
183
+ Classifier: Topic :: System :: Networking
184
+ Classifier: Typing :: Typed
185
+ Requires-Python: >=3.11
186
+ Description-Content-Type: text/markdown
187
+ License-File: LICENSE
188
+ Requires-Dist: tigrcorn-core==0.3.16.dev5
189
+ Requires-Dist: tigrcorn-config==0.3.16.dev5
190
+ Requires-Dist: tigrcorn-asgi==0.3.16.dev5
191
+ Requires-Dist: tigrcorn-transports==0.3.16.dev5
192
+ Requires-Dist: tigrcorn-protocols==0.3.16.dev5
193
+ Requires-Dist: tigrcorn-security==0.3.16.dev5
194
+ Provides-Extra: uvloop
195
+ Requires-Dist: uvloop>=0.19.0; platform_system != "Windows" and extra == "uvloop"
196
+ Provides-Extra: trio
197
+ Requires-Dist: trio>=0.25.0; extra == "trio"
198
+ Dynamic: license-file
199
+
200
+ <div align="center">
201
+ <h1>tigrcorn-runtime</h1>
202
+
203
+ <p><strong>Server runner, app loading, lifecycle hooks, workers, reload, and embedded runtime for the Tigrcorn ASGI3 web server.</strong></p>
204
+
205
+ <a href="https://pypi.org/project/tigrcorn-runtime/"><img alt="PyPI version for tigrcorn-runtime" src="https://img.shields.io/pypi/v/tigrcorn-runtime?label=PyPI"></a>
206
+ <a href="https://pypi.org/project/tigrcorn-runtime/"><img alt="tigrcorn-runtime package on PyPI" src="https://img.shields.io/badge/package-PyPI-blue"></a>
207
+ <a href="LICENSE"><img alt="Apache 2.0 license" src="https://img.shields.io/badge/license-Apache%202.0-525252"></a>
208
+ <a href="pyproject.toml"><img alt="Python 3.11 supported" src="https://img.shields.io/badge/python-3.11-3776ab"></a>
209
+ <a href="pyproject.toml"><img alt="Python 3.12 supported" src="https://img.shields.io/badge/python-3.12-3776ab"></a>
210
+ <a href="pyproject.toml"><img alt="Python 3.13 supported" src="https://img.shields.io/badge/python-3.13-3776ab"></a>
211
+ <a href="src/tigrcorn_runtime/py.typed"><img alt="typed package" src="https://img.shields.io/badge/typed-py.typed-2f7ed8"></a>
212
+ <a href="https://pypi.org/project/tigrcorn-runtime/"><img alt="runtime role package" src="https://img.shields.io/badge/role-runtime-0a7f5a"></a>
213
+ </div>
214
+
215
+ ## Install
216
+
217
+ ~~~bash
218
+ pip install tigrcorn-runtime
219
+ ~~~
220
+
221
+ Use the aggregate [tigrcorn](https://pypi.org/project/tigrcorn/) distribution when you want the full ASGI3 Python web server stack. Install <code>tigrcorn-runtime</code> directly when you want only this package boundary and its declared dependencies.
222
+
223
+ ## What It Owns
224
+
225
+ <code>tigrcorn-runtime</code> owns server runner, app loading, bootstrap, signals, shutdown, workers, embedding, reload, and CLI-facing runtime orchestration. Its import package is <code>tigrcorn_runtime</code>, and its declared package dependencies are: tigrcorn-core, tigrcorn-config, tigrcorn-asgi, tigrcorn-transports, tigrcorn-protocols, tigrcorn-security.
226
+
227
+ This package page is written for developers searching for Tigrcorn ASGI3 server components, Python web server packages, HTTP/3 and QUIC support, WebSocket and WebTransport runtime surfaces, typed package boundaries, and Apache 2.0 licensed infrastructure.
228
+
229
+ ## Use It When
230
+
231
+ Use <code>tigrcorn-runtime</code> when you need to run, embed, supervise, or lifecycle-manage Tigrcorn as an ASGI3 Python web server. It is part of Tigrcorn's split-package architecture, so it can be installed independently while remaining linked to the rest of the Tigrcorn package family on PyPI.
232
+
233
+ ## Import Surface
234
+
235
+ ~~~python
236
+ import tigrcorn_runtime
237
+
238
+ print(tigrcorn_runtime.__name__)
239
+ ~~~
240
+
241
+ The package exposes its supported public surface through the <code>tigrcorn_runtime</code> namespace. The root [tigrcorn](https://pypi.org/project/tigrcorn/) package keeps compatibility shims for users who install the full server distribution.
242
+
243
+ ## Package Graph
244
+
245
+ [tigrcorn](https://pypi.org/project/tigrcorn/) | [tigrcorn-core](https://pypi.org/project/tigrcorn-core/) | [tigrcorn-config](https://pypi.org/project/tigrcorn-config/) | [tigrcorn-asgi](https://pypi.org/project/tigrcorn-asgi/) | [tigrcorn-contract](https://pypi.org/project/tigrcorn-contract/) | [tigrcorn-transports](https://pypi.org/project/tigrcorn-transports/) | [tigrcorn-protocols](https://pypi.org/project/tigrcorn-protocols/) | [tigrcorn-http](https://pypi.org/project/tigrcorn-http/) | [tigrcorn-security](https://pypi.org/project/tigrcorn-security/) | [tigrcorn-runtime](https://pypi.org/project/tigrcorn-runtime/) | [tigrcorn-static](https://pypi.org/project/tigrcorn-static/) | [tigrcorn-observability](https://pypi.org/project/tigrcorn-observability/) | [tigrcorn-compat](https://pypi.org/project/tigrcorn-compat/) | [tigrcorn-certification](https://pypi.org/project/tigrcorn-certification/)