aiowrap-0.1.1


توضیحات

Tools for wrapping existing synchronous libraries into Python3's asyncio framework.
ویژگی مقدار
سیستم عامل OS Independent
نام فایل aiowrap-0.1.1
نام aiowrap
نسخه کتابخانه 0.1.1
نگهدارنده []
ایمیل نگهدارنده []
نویسنده iceboy
ایمیل نویسنده me@iceboy.org
آدرس صفحه اصلی https://github.com/iceboy-sjtu/aiowrap
آدرس اینترنتی https://pypi.org/project/aiowrap/
مجوز http://www.apache.org/licenses/LICENSE-2.0
aiowrap ======= Simple example -------------- Assume that you have some existing libraries with blocking methods:: def foo_sync(x, a, b): """Some existing library methods. Sleeps for x seconds and returns a + b.""" time.sleep(x) return a + b And you are writing a program in Python3's `asyncio` framework. To use the blocking library, one way is to use a thread pool. This library provides another option:: # Wraps foo_sync() into foo_async() to use in asyncio framework. time.sleep = aiowrap.wrap_async(asyncio.sleep) foo_async = aiowrap.wrap_sync(foo_sync) Now you have an asynchronous, non-blocking version of the method, you can call it inside your favourite coroutine:: async def main(): print(await foo_async(1, 2, 3)) The source code of this example can be found at `example/sleep.py`.


نحوه نصب


نصب پکیج whl aiowrap-0.1.1:

    pip install aiowrap-0.1.1.whl


نصب پکیج tar.gz aiowrap-0.1.1:

    pip install aiowrap-0.1.1.tar.gz