mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-23 02:06:36 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,162 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: backports.asyncio.runner
|
||||
Version: 1.2.0
|
||||
Summary: Backport of asyncio.Runner, a context manager that controls event loop life cycle.
|
||||
Project-URL: Homepage, https://github.com/samypr100/backports.asyncio.runner
|
||||
Project-URL: Changelog, https://github.com/samypr100/backports.asyncio.runner/blob/main/CHANGELOG.md
|
||||
Author-email: samypr100 <3933065+samypr100@users.noreply.github.com>
|
||||
License: PSF-2.0
|
||||
License-File: LICENSE.md
|
||||
Keywords: asyncio,asyncio.Runner,backports,backports.asyncio,backports.asyncio.Runner
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Python Software Foundation License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Typing :: Typed
|
||||
Requires-Python: <3.11,>=3.8
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
# backports.asyncio.runner
|
||||
|
||||
[![PyPI version][project-badge]](https://pypi.org/project/backports.asyncio.runner)
|
||||
[![GitHub Actions][github-actions-badge]](https://github.com/samypr100/backports.asyncio.runner/actions/workflows/main.yml)
|
||||
[![Hatch][hatch-badge]](https://github.com/pypa/hatch)
|
||||
[![Ruff][ruff-badge]](https://github.com/astral-sh/ruff)
|
||||
[![Uv][uv-badge]](https://github.com/astral-sh/uv)
|
||||
[![Type checked with mypy][mypy-badge]](https://mypy-lang.org)
|
||||
[![Coverage][coverage-badge]](https://coverage.readthedocs.io)
|
||||
|
||||
[project-badge]: https://badge.fury.io/py/backports.asyncio.runner.svg
|
||||
[github-actions-badge]: https://github.com/samypr100/backports.asyncio.runner/actions/workflows/main.yml/badge.svg
|
||||
[hatch-badge]: https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg
|
||||
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
||||
[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json
|
||||
[mypy-badge]: https://www.mypy-lang.org/static/mypy_badge.svg
|
||||
[coverage-badge]: https://gist.githubusercontent.com/samypr100/8682bd2df950670a45095c7c109a176e/raw/coverage.svg
|
||||
|
||||
This is a backport of Python 3.11 [asyncio.Runner](https://docs.python.org/3/library/asyncio-runner.html#asyncio.Runner), a context manager that simplifies multiple async
|
||||
function calls in the same context.
|
||||
|
||||
This backports provides full compatibility with Python 3.11 `asyncio.Runner` features, including `contextvars.Context` support.
|
||||
As such, the Python 3.11 test suite for `asyncio.Runner` is used as-is to test its functionality.
|
||||
|
||||
This backport is meant to work with Python 3.8, 3.9, and 3.10 only. Users of Python 3.11 or above should
|
||||
not use this package directly.
|
||||
|
||||
To install, you can use `python -m pip install backports.asyncio.runner` or your favorite python package manager.
|
||||
You might need to include a marker (e.g. `python_version < '3.11'`) to prevent installation on Python 3.11 or above.
|
||||
|
||||
An example of the recommended way to use this context manager is in the below code snippet:
|
||||
|
||||
```python
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
from backports.asyncio.runner import Runner
|
||||
else:
|
||||
from asyncio import Runner
|
||||
|
||||
async def echo(msg: str) -> None:
|
||||
print(f"Hello {msg}")
|
||||
|
||||
with Runner() as runner:
|
||||
runner.run(echo("World"))
|
||||
|
||||
# Hello World
|
||||
```
|
||||
|
||||
## uvloop
|
||||
|
||||
This backport is also compatible with [uvloop](https://github.com/MagicStack/uvloop). An example is below:
|
||||
|
||||
```python
|
||||
import sys
|
||||
import uvloop
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
from backports.asyncio.runner import Runner
|
||||
else:
|
||||
from asyncio import Runner
|
||||
|
||||
async def echo(msg: str) -> None:
|
||||
print(f"Hello {msg}")
|
||||
|
||||
with Runner(loop_factory=uvloop.new_event_loop) as runner:
|
||||
runner.run(echo("World"))
|
||||
|
||||
# Hello World
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Feel free to open a PR if there's changes you'd like to make as long as the changes maintain full reference implementation
|
||||
with Python 3.11's implementation of `asyncio.Runner`. More documentation and additional tests are always welcome as CPython's
|
||||
test don't seem to provide 100% coverage at a glance or more likely I may have missed including some tests.
|
||||
|
||||
* [ruff](https://github.com/astral-sh/ruff) is used to format the code via `ruff format`.
|
||||
* To run ruff, make sure `uv` is installed and run `uv run ruff format src tests`
|
||||
* To run ruff on applicable python versions, run `uv run nox -rs fmt`
|
||||
* [mypy](https://github.com/python/mypy) is used to check types in the sources (while attempting to stay true to reference implementation).
|
||||
* To run mypy, make sure `uv` is installed and run `uv run mypy src`
|
||||
* To run mypy on applicable python versions, run `uv run nox -rs ty`
|
||||
* To run tests use `uv run python -m unittest discover -s tests`
|
||||
* For applicable python versions `uv run nox -rs tests`
|
||||
* To gather coverage use `uv run coverage run -m unittest discover -s tests`
|
||||
* For applicable python versions `uv run nox -rs tests -- --cov`
|
||||
|
||||
Relevant reference implementation sources:
|
||||
* https://github.com/python/cpython/blob/3.11/Lib/asyncio/runners.py
|
||||
* https://github.com/python/cpython/blob/3.11/Lib/asyncio/tasks.py
|
||||
* https://github.com/python/cpython/blob/3.11/Lib/asyncio/base_events.py
|
||||
* https://github.com/python/cpython/blob/3.11/Modules/_asynciomodule.c
|
||||
* https://github.com/python/cpython/blob/3.11/Lib/test/test_asyncio/test_runners.py
|
||||
* https://github.com/python/cpython/blob/3.8/Lib/test/test_asyncio/test_tasks.py
|
||||
* https://github.com/python/cpython/blob/3.9/Lib/test/test_asyncio/test_tasks.py
|
||||
* https://github.com/python/cpython/blob/3.10/Lib/test/test_asyncio/test_tasks.py
|
||||
|
||||
## Caveats
|
||||
|
||||
This implementation uses `asyncio.tasks._PyTask` instead of `asyncio.tasks._CTask` as it adds additional functionality to
|
||||
`asyncio.Task` in order to support `asyncio.Runner` requirements. Hence, the `asyncio.Task` implementation `Runner` will
|
||||
use also comes from this package. As such, problems can arise when checking `isinstance(some_runner_main_task, asyncio.Task)`
|
||||
since `asyncio.Task` can point to `_CTask` by default instead of `_PyTask`. You may encounter the same issue when comparing
|
||||
it to `asyncio.Future`.
|
||||
|
||||
To guarantee full `asyncio.Task` functionality, upstream tests for `asyncio.Task` for 3.8, 3.9, and 3.10 are also part of the
|
||||
testing suite of this package to make sure all changes to `asyncio.Task` used by the `Runner` are fully compatible with
|
||||
`asyncio.Task`. Important Note: `asyncio.Task` is **only** patched on the `Runner`, not globally, hence there should be
|
||||
no side effects to external code when using this module.
|
||||
|
||||
Currently, a backport of `_CTask` is not provided on this package and not in scope at this time. This means that there's a slight
|
||||
performance degradation when using this `asyncio.Runner` implementation over the one in Python 3.11 or above.
|
||||
# 1.2.0
|
||||
|
||||
* Backport bug fix for https://github.com/python/cpython/issues/112559
|
||||
* Declare `patch` and `patch.patch_object` as internal.
|
||||
* Improved `runner.py` typedefs.
|
||||
|
||||
# 1.1.0
|
||||
|
||||
* Add basic `noxfile` with uv backend.
|
||||
* Simplified patching implementation.
|
||||
* Test dependency updates.
|
||||
|
||||
# 1.0.2
|
||||
|
||||
* Add `uvloop` example to README.md
|
||||
* Improved tests coverage.
|
||||
* Improved modified code documentation.
|
||||
|
||||
# 1.0.1
|
||||
|
||||
* `requires-python` metadata is now properly set to ">=3.8,<3.11"
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Initial Reference Implementation
|
||||
@@ -0,0 +1,17 @@
|
||||
../../../../../../Library/Caches/com.apple.python/Users/dzaitsev/azaion-gps-denien-onboard-gemini/gps-denied-onboard/venv/lib/python3.9/site-packages/backports/asyncio/runner/__init__.cpython-39.pyc,,
|
||||
../../../../../../Library/Caches/com.apple.python/Users/dzaitsev/azaion-gps-denien-onboard-gemini/gps-denied-onboard/venv/lib/python3.9/site-packages/backports/asyncio/runner/_int_to_enum.cpython-39.pyc,,
|
||||
../../../../../../Library/Caches/com.apple.python/Users/dzaitsev/azaion-gps-denien-onboard-gemini/gps-denied-onboard/venv/lib/python3.9/site-packages/backports/asyncio/runner/_patch.cpython-39.pyc,,
|
||||
../../../../../../Library/Caches/com.apple.python/Users/dzaitsev/azaion-gps-denien-onboard-gemini/gps-denied-onboard/venv/lib/python3.9/site-packages/backports/asyncio/runner/runner.cpython-39.pyc,,
|
||||
../../../../../../Library/Caches/com.apple.python/Users/dzaitsev/azaion-gps-denien-onboard-gemini/gps-denied-onboard/venv/lib/python3.9/site-packages/backports/asyncio/runner/tasks.cpython-39.pyc,,
|
||||
backports/asyncio/runner/__init__.py,sha256=k_He0OTLVqRmAvL20jfsLC64c1VpjCKlbIGs5Yh22oQ,1501
|
||||
backports/asyncio/runner/_int_to_enum.py,sha256=wJ-EKgF3WVZE-ewQyOegeOaYjBC8XOapZQoRpygU2Zo,710
|
||||
backports/asyncio/runner/_patch.py,sha256=PzgAuKbkNhapErSnYDN3a07CIlTVtKeRqNKI8eQOW3U,651
|
||||
backports/asyncio/runner/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
backports/asyncio/runner/runner.py,sha256=0Oso0DZajq-q8FYEnof8-ac4E7DROG894UvsORTGh8c,9564
|
||||
backports/asyncio/runner/runner.pyi,sha256=WUiTgZ8jGup99W_6PE1hJl_XvYaHdtAhbsGZ1vF58L8,760
|
||||
backports/asyncio/runner/tasks.py,sha256=90W9p5AC6kqY1cLRmmZIunVo5yUlARUj7S1Vvs76n_4,3667
|
||||
backports_asyncio_runner-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
backports_asyncio_runner-1.2.0.dist-info/METADATA,sha256=eRLCTQum8UpIOkP3upylTrQg1Qsgr3-EeoWeH91tMFg,7542
|
||||
backports_asyncio_runner-1.2.0.dist-info/RECORD,,
|
||||
backports_asyncio_runner-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
||||
backports_asyncio_runner-1.2.0.dist-info/licenses/LICENSE.md,sha256=Qtx6vv87VIhgojdzr7ZJV4X9nehr1sHBbjv-dnFbePA,2339
|
||||
@@ -0,0 +1,4 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: hatchling 1.27.0
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright , i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.
|
||||
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.
|
||||
4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
|
||||
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
|
||||
8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this License Agreement.
|
||||
Reference in New Issue
Block a user