All Projects → omnilib → Aiomultiprocess

omnilib / Aiomultiprocess

Licence: mit
Take a modern Python codebase to the next level of performance.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Aiomultiprocess

Fooproxy
稳健高效的评分制-针对性- IP代理池 + API服务,可以自己插入采集器进行代理IP的爬取,针对你的爬虫的一个或多个目标网站分别生成有效的IP代理数据库,支持MongoDB 4.0 使用 Python3.7(Scored IP proxy pool ,customise proxy data crawler can be added anytime)
Stars: ✭ 195 (-81.78%)
Mutual labels:  async, asyncio, multiprocessing
Aredis
redis client for Python asyncio (has support for redis server, sentinel and cluster)
Stars: ✭ 576 (-46.17%)
Mutual labels:  async, asyncio
Tornado Celery
Non-blocking Celery client for Tornado
Stars: ✭ 561 (-47.57%)
Mutual labels:  async, asyncio
Fennel
A task queue library for Python and Redis
Stars: ✭ 24 (-97.76%)
Mutual labels:  async, asyncio
Requests Threads
🎭 Twisted Deferred Thread backend for Requests.
Stars: ✭ 366 (-65.79%)
Mutual labels:  async, asyncio
Lahja
Lahja is a generic multi process event bus implementation written in Python 3.6+ to enable lightweight inter-process communication, based on non-blocking asyncio
Stars: ✭ 374 (-65.05%)
Mutual labels:  async, asyncio
Fastapi Users
Ready-to-use and customizable users management for FastAPI
Stars: ✭ 713 (-33.36%)
Mutual labels:  async, asyncio
Async Techniques Python Course
Async Techniques and Examples in Python Course
Stars: ✭ 314 (-70.65%)
Mutual labels:  async, asyncio
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+3599.81%)
Mutual labels:  async, asyncio
Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-97.29%)
Mutual labels:  async, asyncio
Vim Strand
A barebones Vim plugin manger written in Rust
Stars: ✭ 38 (-96.45%)
Mutual labels:  async, asyncio
Github Stats
Better GitHub statistics images for your profile, no external server required
Stars: ✭ 338 (-68.41%)
Mutual labels:  async, asyncio
Picoweb
Really minimal web application framework for the Pycopy project (minimalist Python dialect) and its "uasyncio" async framework
Stars: ✭ 361 (-66.26%)
Mutual labels:  async, asyncio
Aioprocessing
A Python 3.4+ library that integrates the multiprocessing module with asyncio
Stars: ✭ 438 (-59.07%)
Mutual labels:  asyncio, multiprocessing
Example Hftish
Example Order Book Imbalance Algorithm
Stars: ✭ 355 (-66.82%)
Mutual labels:  async, asyncio
Arq
Fast job queuing and RPC in python with asyncio and redis.
Stars: ✭ 695 (-35.05%)
Mutual labels:  async, asyncio
Uvloop
Ultra fast asyncio event loop.
Stars: ✭ 8,246 (+670.65%)
Mutual labels:  async, asyncio
Aiologger
Asynchronous logging for python and asyncio
Stars: ✭ 284 (-73.46%)
Mutual labels:  async, asyncio
Sqlalchemy aio
Asyncio strategy for SQLAlchemy.
Stars: ✭ 299 (-72.06%)
Mutual labels:  async, asyncio
Chili
Chili: HTTP Served Hot
Stars: ✭ 7 (-99.35%)
Mutual labels:  async, asyncio

aiomultiprocess

Take a modern Python codebase to the next level of performance.

version documentation changelog license build status code coverage code style

On their own, AsyncIO and multiprocessing are useful, but limited: AsyncIO still can't exceed the speed of GIL, and multiprocessing only works on one task at a time. But together, they can fully realize their true potential.

aiomultiprocess presents a simple interface, while running a full AsyncIO event loop on each child process, enabling levels of concurrency never before seen in a Python application. Each child process can execute multiple coroutines at once, limited only by the workload and number of cores available.

Gathering tens of thousands of network requests in seconds is as easy as:

async with Pool() as pool:
    results = await pool.map(<coroutine function>, <items>)

Install

aiomultiprocess requires Python 3.6 or newer. You can install it from PyPI:

$ pip3 install aiomultiprocess

Usage

Most of aiomultiprocess mimics the standard multiprocessing module whenever possible, while accounting for places that benefit from async functionality.

Running your asynchronous jobs on a pool of worker processes is easy:

import asyncio
from aiohttp import request
from aiomultiprocess import Pool

async def get(url):
    async with request("GET", url) as response:
        return await response.text("utf-8")

async def main():
    urls = ["https://jreese.sh", ...]
    async with Pool() as pool:
        async for result in pool.map(get, urls):
            ...  # process result
            
if __name__ == '__main__':
    # Python 3.7
    asyncio.run(main())
    
    # Python 3.6
    # loop = asyncio.get_event_loop()
    # loop.run_until_complete(main())

Take a look at the User Guide for more details and examples.

For further context, watch the PyCon US 2018 talk about aiomultiprocess, "Thinking Outside the GIL":

IMAGE ALT TEXT

Slides available at Speaker Deck.

License

aiomultiprocess is copyright John Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].