asyncio-atexit-1.0.1
توضیحات
Like atexit, but for asyncio
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | asyncio-atexit-1.0.1 |
| نام | asyncio-atexit |
| نسخه کتابخانه | 1.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Min RK |
| ایمیل نویسنده | benjaminrk@gmail.com |
| آدرس صفحه اصلی | https://github.com/minrk/asyncio-atexit |
| آدرس اینترنتی | https://pypi.org/project/asyncio-atexit/ |
| مجوز | MIT License |
# asyncio atexit
Adds atexit functionality to asyncio:
```python
import asyncio_atexit
async def close_db():
await db_connection.close()
asyncio_atexit.register(close_db)
```
[atexit][] is part of the standard library,
and gives you a way to register functions to call when the interpreter exits.
[atexit]: https://docs.python.org/3/library/atexit.html
asyncio doesn't have equivalent functionality to register functions
when the _event loop_ exits:
This package adds functionality that can be considered equivalent to `atexit.register`,
but tied to the event loop lifecycle. It:
1. accepts both coroutines and synchronous functions
1. should be called from a running event loop
1. calls registered cleanup functions when the event loop closes
1. only works if the application running the event loop calls `close()`
نیازمندی
| مقدار | نام |
|---|---|
| - | pytest |
| - | uvloop |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl asyncio-atexit-1.0.1:
pip install asyncio-atexit-1.0.1.whl
نصب پکیج tar.gz asyncio-atexit-1.0.1:
pip install asyncio-atexit-1.0.1.tar.gz