aioimport-0.1.5
توضیحات
Asynchronous module import for asyncio
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | aioimport-0.1.5 |
| نام | aioimport |
| نسخه کتابخانه | 0.1.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | rndr |
| ایمیل نویسنده | rndr@users.noreply.github.com |
| آدرس صفحه اصلی | https://github.com/rndr/aioimport |
| آدرس اینترنتی | https://pypi.org/project/aioimport/ |
| مجوز | MIT |
# aioimport
Asynchronous module import for asyncio
## Getting Started
### Installing
Install from [PyPI](https://pypi.org/project/aioimport/) using:
```
pip install aioimport
```
### The problem
Some naughty modules have long running operations during import
#### Naive solution
First thing that comes to mind is make import local:
```python
async def my_work() -> None:
import naughty # will block event loop
```
It reduces time your program takes to start (or library to import),
but it is still blocking your event loop.
### Usage
```python
import aioimport
async def my_work() -> None:
await aioimport.import_module("naughty") # will asynchronously import module
import naughty # will be instantaneous since `naughty` is already in `sys.modules`
await aioimport.reload(naughty) # and you can asynchronously reload modules too
```
### How it works
Module import is done in asyncio default executor.
Be aware of the fact that GIL still exists and technically import is done concurrently rather than in parallel with your code.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl aioimport-0.1.5:
pip install aioimport-0.1.5.whl
نصب پکیج tar.gz aioimport-0.1.5:
pip install aioimport-0.1.5.tar.gz