Skip to main content

Library helps easy write concurrent executed code blocks

Project description


Library helps to easily write concurrent executed code blocks.

Quick example:

import asyncio
from concurrently import concurrently

async def amain(loop):
    How to fetch some web pages with concurrently.
    urls = [  # define pages urls
    results = {}

    # immediately run wrapped function concurrent
    # in 2 thread (asyncio coroutines)
    async def fetch_urls():
        for url in urls:
            # some function for download page
            page = await fetch_page(url)
            results[url] = page

    # wait until all concurrent threads finished
    await fetch_urls()

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
Decorator @concurrently makes to main thinks:
  • starts concurrent execution specified count of decorated function
  • returns special waiter object to control the running functions

By default, the code runs as asyncio coroutines, but there are other supported ways to execute, by specifying the argument engine.


Now support only Python 3.5 and above.


From PyPi:

$ pip install concurrently

From local:

# update setuptools
$ pip install 'setuptools >= 30.4'
# do install
$ make install
# or
$ pip install .


Prepare and activate virtual environment like:

$ python3 -m venv .env
# for bash
$ source .env/bin/activate
# for fish
$ . .env/bin/

Update pre-install dependencies:

$ pip install 'setuptools >= 30.4'


$ make install_dev
# or
$ pip install --editable .[develop]

Run tests:

$ make test
# or
$ pytest tests/

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

concurrently-1.2.tar.gz (10.2 kB view hashes)

Uploaded source

Built Distribution

concurrently-1.2-py3-none-any.whl (14.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page