Skip to main content

Simple concurrent runner for threads, processes, and async tasks

Project description

conrun

ci PyPI Python License

Simple concurrent runner for async tasks, threads and processes – one API, one object.

⚠️ Work-in-progress

conrun is under active development. Until v1.0 the public API may change without notice. Feel free to experiment, but pin the exact version in production.

Features

  • One-liner concurrency – run any coroutine, function, or CPU-bound task concurrently with a single call.
  • Three modes • async → native asyncio concurrency • threadThreadPoolExecutor under the hood • processProcessPoolExecutor for CPU-bound work
  • Safe nesting – a single Runner can be reused recursively; the executor shuts down exactly once.
  • Back-pressure – max_workers + semaphore keep concurrency under control.
  • Sync and async entry points – call from “normal” code (run) or inside an event loop (arun).

Supported Python versions: 3.10 · 3.11 · 3.12 · 3.13

Installation

pip install conrun

Quick start

import asyncio
from conrun import Runner


async def my_function(text: str) -> str:
    await asyncio.sleep(1)
    return text.upper()


async def main():
    result = await Runner(mode="async", max_workers=3).arun(
        my_function,
        ["a", "b", "c"],
    )
    print(result)  # ['A', 'B', 'C']


if __name__ == "__main__":
    asyncio.run(main())

License

MIT – см. файл LICENSE.

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

conrun-0.1.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conrun-0.1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file conrun-0.1.2.tar.gz.

File metadata

  • Download URL: conrun-0.1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for conrun-0.1.2.tar.gz
Algorithm Hash digest
SHA256 276361541610bce1a7422953992735f96ec4b58a9ef0703ffac79a21becd6c6a
MD5 3a104a36e51a457d7ff99176947ae191
BLAKE2b-256 2779b3733407d3cf96dfb045c02a20834a325713ba376b3490bbfd0980c31cde

See more details on using hashes here.

Provenance

The following attestation bundles were made for conrun-0.1.2.tar.gz:

Publisher: release.yml on DmitriiKhudiakov/conrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conrun-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: conrun-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for conrun-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56e1914a0ae427966fdb86b59cf6955e0f7d1d5d9b136f76d30022326e6a64ba
MD5 2203c78eb3164b3e7aacb36c887c9aef
BLAKE2b-256 b8db219cb3df9d3b5e362bfe59258ce92252fb1baea1607d2ba01f7c01368a85

See more details on using hashes here.

Provenance

The following attestation bundles were made for conrun-0.1.2-py3-none-any.whl:

Publisher: release.yml on DmitriiKhudiakov/conrun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page