rsloop 0.1.3__cp38-cp38-win_amd64.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.
rsloop/__init__.py ADDED
@@ -0,0 +1,142 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio as __asyncio
4
+ import contextlib as __contextlib
5
+ import os as __os
6
+ import sys as __sys
7
+ import typing as __typing
8
+
9
+ from ._loop import PyLoop as Loop
10
+ from ._loop import __version__
11
+ from ._loop import open_connection as __open_connection
12
+ from ._loop import profiler_running as __profiler_running
13
+ from ._loop import start_profiler as __start_profiler
14
+ from ._loop import start_server as __start_server
15
+ from ._loop import stop_profiler as __stop_profiler
16
+
17
+ __all__: tuple[str, ...] = (
18
+ "Loop",
19
+ "__version__",
20
+ "new_event_loop",
21
+ "profile",
22
+ "profiler_running",
23
+ "run",
24
+ "start_profiler",
25
+ "stop_profiler",
26
+ )
27
+ _T = __typing.TypeVar("_T")
28
+ __ORIG_SET_EVENT_LOOP = __asyncio.set_event_loop
29
+
30
+
31
+ def __set_event_loop(loop: Loop | None) -> None:
32
+ try:
33
+ __ORIG_SET_EVENT_LOOP(loop)
34
+ return
35
+ except (AssertionError, TypeError):
36
+ if loop is None or not isinstance(loop, Loop):
37
+ raise
38
+
39
+ # Python 3.8 rejects non-stdlib loop objects in set_event_loop() with a
40
+ # hard isinstance() assertion. Mirror the stdlib policy bookkeeping so
41
+ # get_event_loop() still returns the current rsloop instance.
42
+ policy = __asyncio.get_event_loop_policy()
43
+ local = getattr(policy, "_local", None)
44
+ if local is None:
45
+ raise
46
+ local._set_called = True
47
+ local._loop = loop
48
+
49
+
50
+ if __asyncio.set_event_loop is __ORIG_SET_EVENT_LOOP:
51
+ __asyncio.set_event_loop = __set_event_loop
52
+ __asyncio.events.set_event_loop = __set_event_loop
53
+
54
+
55
+ def new_event_loop() -> Loop:
56
+ return Loop()
57
+
58
+
59
+ def profiler_running() -> bool:
60
+ return __profiler_running()
61
+
62
+
63
+ def start_profiler(*, frequency: int = 999) -> None:
64
+ __start_profiler(frequency=frequency)
65
+
66
+
67
+ def stop_profiler(
68
+ path: str | __os.PathLike[str],
69
+ *,
70
+ format: str = "flamegraph",
71
+ ) -> str:
72
+ return __stop_profiler(__os.fspath(path), format=format)
73
+
74
+
75
+ @__contextlib.contextmanager
76
+ def profile(
77
+ path: str | __os.PathLike[str],
78
+ *,
79
+ frequency: int = 999,
80
+ format: str = "flamegraph",
81
+ ) -> __typing.Iterator[str]:
82
+ resolved_path = __os.fspath(path)
83
+ start_profiler(frequency=frequency)
84
+ try:
85
+ yield resolved_path
86
+ finally:
87
+ stop_profiler(resolved_path, format=format)
88
+
89
+
90
+ __ORIG_OPEN_CONNECTION = __asyncio.open_connection
91
+ __ORIG_START_SERVER = __asyncio.start_server
92
+ __USE_FAST_STREAMS = __os.environ.get("RSLOOP_USE_FAST_STREAMS", "1") != "0"
93
+
94
+
95
+ if __USE_FAST_STREAMS and __asyncio.open_connection is __ORIG_OPEN_CONNECTION:
96
+ __asyncio.open_connection = __open_connection
97
+ if __USE_FAST_STREAMS and __asyncio.start_server is __ORIG_START_SERVER:
98
+ __asyncio.start_server = __start_server
99
+
100
+
101
+ if __typing.TYPE_CHECKING:
102
+
103
+ def run(
104
+ main: __typing.Coroutine[__typing.Any, __typing.Any, _T],
105
+ *,
106
+ loop_factory: __typing.Callable[[], Loop] = new_event_loop,
107
+ debug: bool | None = None,
108
+ ) -> _T: ...
109
+ else:
110
+
111
+ def run(main, *, loop_factory=new_event_loop, debug=None, **run_kwargs):
112
+ async def wrapper():
113
+ loop = __asyncio._get_running_loop()
114
+ if not isinstance(loop, Loop):
115
+ raise TypeError("rsloop.run() uses a non-rsloop loop")
116
+ return await main
117
+
118
+ if __sys.version_info[:2] >= (3, 12):
119
+ return __asyncio.run(
120
+ wrapper(),
121
+ loop_factory=loop_factory,
122
+ debug=debug,
123
+ **run_kwargs,
124
+ )
125
+
126
+ if __asyncio._get_running_loop() is not None:
127
+ raise RuntimeError(
128
+ "asyncio.run() cannot be called from a running event loop"
129
+ )
130
+
131
+ if not __asyncio.iscoroutine(main):
132
+ raise ValueError(f"a coroutine was expected, got {main!r}")
133
+
134
+ loop = loop_factory()
135
+ try:
136
+ __asyncio.set_event_loop(loop)
137
+ if debug is not None:
138
+ loop.set_debug(debug)
139
+ return loop.run_until_complete(wrapper())
140
+ finally:
141
+ __asyncio.set_event_loop(None)
142
+ loop.close()
Binary file
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: rsloop
3
+ Version: 0.1.3
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: License :: OSI Approved :: Apache Software License
7
+ Classifier: Operating System :: MacOS
8
+ Classifier: Operating System :: POSIX :: Linux
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Rust
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: System :: Networking
22
+ License-File: LICENSE
23
+ Summary: An event loop for asyncio written in Rust
24
+ Keywords: asyncio,event-loop,pyo3,python,rust
25
+ Home-Page: https://github.com/RustedBytes/rsloop
26
+ Author: RustedBytes
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
29
+ Project-URL: Homepage, https://github.com/RustedBytes/rsloop
30
+ Project-URL: Issues, https://github.com/RustedBytes/rsloop/issues
31
+ Project-URL: Repository, https://github.com/RustedBytes/rsloop
32
+
33
+ <img src="./rsloop.png" alt="rsloop logo" align="center">
34
+
35
+ # An event loop for asyncio written in Rust
36
+
37
+ [![PyPI - Version](https://img.shields.io/pypi/v/rsloop)](https://pypi.org/project/rsloop/)
38
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/rsloop?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/rsloop)
39
+
40
+ `rsloop` is a PyO3-based `asyncio` event loop implemented in Rust.
41
+
42
+ Each `rsloop.Loop` owns a dedicated Rust runtime thread for loop coordination
43
+ and I/O work. Python callbacks, tasks, and coroutines still run on the thread
44
+ that calls `run_forever()` or `run_until_complete()` (usually the main Python
45
+ thread).
46
+
47
+ The package exposes:
48
+
49
+ - a native extension module at `rsloop._loop`
50
+ - a Python wrapper in `python/rsloop/__init__.py`
51
+ - `rsloop.Loop`, `rsloop.new_event_loop()`, and `rsloop.run(...)`
52
+
53
+ Repository metadata currently targets Python `>=3.8`. The packaged project now
54
+ supports the core event-loop surface on Linux, macOS, and Windows, including
55
+ Windows pipe transports and subprocess workflows.
56
+
57
+ ## Install
58
+
59
+ From PyPI:
60
+
61
+ ```bash
62
+ pip install rsloop
63
+ ```
64
+
65
+ With `uv`:
66
+
67
+ ```bash
68
+ uv add rsloop
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ Simple entry point:
74
+
75
+ ```python
76
+ import rsloop
77
+
78
+ async def main():
79
+ ...
80
+
81
+ rsloop.run(main())
82
+ ```
83
+
84
+ Manual loop creation also works:
85
+
86
+ ```python
87
+ import asyncio
88
+ import rsloop
89
+
90
+ loop = rsloop.new_event_loop()
91
+ asyncio.set_event_loop(loop)
92
+ try:
93
+ loop.run_until_complete(...)
94
+ finally:
95
+ asyncio.set_event_loop(None)
96
+ loop.close()
97
+ ```
98
+
99
+ Importing `rsloop` also patches `asyncio.set_event_loop()` so Python 3.8 can
100
+ accept an `rsloop.Loop` instance, matching the behavior exercised by
101
+ `tests/test_run.py`.
102
+
103
+ ## Verified Surface Area
104
+
105
+ The current codebase implements these user-facing areas.
106
+
107
+ Loop lifecycle and scheduling:
108
+
109
+ - `run_forever`, `run_until_complete`, `stop`, `close`
110
+ - `time`, `is_running`, `is_closed`
111
+ - `get_debug`, `set_debug`
112
+ - `call_soon`, `call_soon_threadsafe`, `call_later`, `call_at`
113
+ - returned `Handle` and `TimerHandle` objects with `cancel()` / `cancelled()`
114
+
115
+ Tasks, futures, and execution helpers:
116
+
117
+ - `create_future`, `create_task`
118
+ - `set_task_factory`, `get_task_factory`
119
+ - `set_exception_handler`, `get_exception_handler`,
120
+ `call_exception_handler`, `default_exception_handler`
121
+ - `set_default_executor`, `run_in_executor`
122
+ - `shutdown_asyncgens`, `shutdown_default_executor`
123
+ - callback execution under captured `contextvars.Context`
124
+ - `asyncio.get_running_loop()` support while running on `rsloop`
125
+ - `rsloop.run(...)` helper, with `asyncio.run(..., loop_factory=...)`
126
+ integration on Python 3.12+
127
+
128
+ I/O and networking:
129
+
130
+ - `add_reader`, `remove_reader`, `add_writer`, `remove_writer`
131
+ - `sock_recv`, `sock_recv_into`, `sock_sendall`, `sock_accept`, `sock_connect`
132
+ - `getaddrinfo`, `getnameinfo`
133
+ - `create_server`, `create_connection`
134
+ - `create_unix_server`, `create_unix_connection`
135
+ - `connect_accepted_socket`
136
+ - returned `Server` objects with `close()`, `is_serving()`, `get_loop()`,
137
+ and `sockets()`
138
+ - returned `StreamTransport` objects with `write()`, `writelines()`, `close()`,
139
+ `abort()`, `is_closing()`, `write_eof()`, `can_write_eof()`,
140
+ `get_extra_info()`, `get_protocol()`, `set_protocol()`,
141
+ `pause_reading()`, `resume_reading()`, `is_reading()`
142
+
143
+ Pipes, subprocesses, and signals:
144
+
145
+ - `connect_read_pipe`, `connect_write_pipe`
146
+ - `subprocess_exec`, `subprocess_shell`
147
+ - returned `ProcessTransport` and `ProcessPipeTransport` objects
148
+ - higher-level compatibility with `asyncio.create_subprocess_exec()` and
149
+ `asyncio.create_subprocess_shell()`
150
+ - Unix subprocess options including `cwd`, `env`, `executable`, `pass_fds`,
151
+ `start_new_session`, `process_group`, `user`, `group`, `extra_groups`,
152
+ `umask`, and `restore_signals`
153
+ - `add_signal_handler`, `remove_signal_handler`
154
+
155
+ Profiling:
156
+
157
+ - `profile(...)`, `profiler_running()`, `start_profiler()`, `stop_profiler()`
158
+
159
+ ## Fast Streams
160
+
161
+ Importing `rsloop` patches `asyncio.open_connection()` and
162
+ `asyncio.start_server()` by default.
163
+
164
+ That import-time behavior is controlled by `RSLOOP_USE_FAST_STREAMS` and can be
165
+ disabled with:
166
+
167
+ ```bash
168
+ export RSLOOP_USE_FAST_STREAMS=0
169
+ ```
170
+
171
+ The native fast-stream path is used only when:
172
+
173
+ - the running loop is an `rsloop.Loop`
174
+ - `ssl` is unset or `None`
175
+
176
+ Otherwise `rsloop` falls back to the stdlib `asyncio.streams` helpers.
177
+
178
+ The implementation lives in `src/fast_streams.rs` and is backed by the lower
179
+ level transport code in `src/stream_transport.rs`.
180
+
181
+ ## Current Limitations
182
+
183
+ These gaps are visible in the current implementation.
184
+
185
+ - TLS is not implemented.
186
+ - `start_tls()` is stubbed.
187
+ - `ssl=...` is rejected for `create_server`, `create_connection`,
188
+ `create_unix_server`, `create_unix_connection`, and
189
+ `connect_accepted_socket`.
190
+ - Stream transport flow control is partial:
191
+ `pause_reading()` and `resume_reading()` work, but
192
+ `get_write_buffer_size()` returns `0`,
193
+ `get_write_buffer_limits()` returns `(0, 0)`, and
194
+ `set_write_buffer_limits()` is a no-op.
195
+ - Several compatibility parameters are currently accepted only to preserve API
196
+ shape, not to provide full behavior:
197
+ `server_hostname`, `happy_eyeballs_delay`, `interleave`, `all_errors`,
198
+ `ssl_handshake_timeout`, `ssl_shutdown_timeout`, and
199
+ `shutdown_default_executor(timeout=...)`.
200
+ - Subprocess support is intentionally incomplete:
201
+ `preexec_fn` is unsupported, and text mode is rejected for
202
+ `asyncio.create_subprocess_exec()` /
203
+ `asyncio.create_subprocess_shell()` when using the stdlib subprocess stream
204
+ protocol.
205
+ - Low-level subprocess transport APIs do support text decoding when used with a
206
+ custom subprocess protocol.
207
+ - Unix-specific APIs remain Unix-specific:
208
+ `create_unix_server`, `create_unix_connection`,
209
+ `add_signal_handler`, `remove_signal_handler`.
210
+ - Platform-specific limitations still apply:
211
+ Unix socket APIs and Unix signal handlers remain Unix-only, and several
212
+ subprocess options such as `pass_fds`, `user`, `group`, and `umask` are
213
+ still specific to Unix process spawning.
214
+
215
+ ## Build
216
+
217
+ Quick check:
218
+
219
+ ```bash
220
+ cargo check
221
+ ```
222
+
223
+ Release build and editable install:
224
+
225
+ ```bash
226
+ cargo build --release
227
+ uv run --with maturin maturin develop --release
228
+ ```
229
+
230
+ Build release wheels into `dist/wheels`:
231
+
232
+ ```bash
233
+ scripts/build-wheels.sh
234
+ ```
235
+
236
+ That script currently defaults to CPython `3.8 3.9 3.10 3.11 3.12 3.13 3.14`
237
+ plus free-threaded `3.14t`, and uses `uv python install` / `uv python find` to
238
+ locate interpreters.
239
+
240
+ ## Profiling
241
+
242
+ Profiling is behind the Cargo feature `profiler` and is disabled by default.
243
+ Build or install with that feature first:
244
+
245
+ ```bash
246
+ cargo build --release --features profiler
247
+ uv run --with maturin maturin develop --release --features profiler
248
+ ```
249
+
250
+ Then wrap the code you want to inspect:
251
+
252
+ ```python
253
+ import rsloop
254
+
255
+ with rsloop.profile("rsloop-flamegraph.svg", frequency=999):
256
+ rsloop.run(main())
257
+ ```
258
+
259
+ Or manage the session manually:
260
+
261
+ ```python
262
+ import rsloop
263
+
264
+ rsloop.start_profiler(frequency=999)
265
+ try:
266
+ rsloop.run(main())
267
+ finally:
268
+ rsloop.stop_profiler("rsloop-flamegraph.svg")
269
+ ```
270
+
271
+ Only `format="flamegraph"` is currently implemented. If the extension was built
272
+ without `--features profiler`, `profile()` and `start_profiler()` raise a
273
+ runtime error.
274
+
275
+ ## Examples
276
+
277
+ Run the repository examples from the project root:
278
+
279
+ ```bash
280
+ uv run python examples/01_basics.py
281
+ uv run python examples/02_fd_and_sockets.py
282
+ uv run python examples/03_streams.py
283
+ uv run python examples/04_unix_and_accepted_socket.py
284
+ uv run python examples/05_pipes_signals_subprocesses.py
285
+ ```
286
+
287
+ The repository also includes:
288
+
289
+ - `demo/fastapi_service.py` for running the same FastAPI app on stdlib
290
+ `asyncio`, `uvloop`, or `rsloop`
291
+ - `benchmarks/compare_event_loops.py` for callback, task, and TCP stream
292
+ comparisons
293
+
294
+ ## Benchmark
295
+
296
+ ```bash
297
+ uv run --with maturin maturin develop --release
298
+ uv run --with uvloop python benchmarks/compare_event_loops.py
299
+ ```
300
+
301
+ See `benchmarks/README.md` for workload details and extra flags, and
302
+ `demo/README.md` for the FastAPI loop comparison demo.
303
+
@@ -0,0 +1,7 @@
1
+ rsloop/__init__.py,sha256=5ugvLObjqE7NEjr2WePJGREcxPR4Wdycts8fveD5jTk,4193
2
+ rsloop/_loop.cp38-win_amd64.pyd,sha256=3U4IaLTYRqO1EybDQXlv0MS0KeFoWS64yhIfUq6ffDI,2469376
3
+ rsloop-0.1.3.dist-info/METADATA,sha256=tA5FDK0_GvkPWjHXlH4hTcU1b0d8L5H0_l0WzPJ7kkI,9662
4
+ rsloop-0.1.3.dist-info/WHEEL,sha256=wTvc4riWt9wxLXuCrZ5UPSfDyrrS4htCEUdIVHZdHEA,95
5
+ rsloop-0.1.3.dist-info/licenses/LICENSE,sha256=myvFHBRzKiwdFm0CT0MEfZHqZ17aQipht_E_xafNA78,11546
6
+ rsloop-0.1.3.dist-info/sboms/rsloop.cyclonedx.json,sha256=HXk3garYWd1VUg8NsABkQm0VXaKJYkiGansx83UPMCs,74701
7
+ rsloop-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.12.6)
3
+ Root-Is-Purelib: false
4
+ Tag: cp38-cp38-win_amd64
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Yehor Smoliakov
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.