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

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.3.tar.gz (5.0 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.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: conrun-0.1.3.tar.gz
  • Upload date:
  • Size: 5.0 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.3.tar.gz
Algorithm Hash digest
SHA256 13752d577729dd237b448b1516b809091bbea85c25190ef1742d8739a5ed1cff
MD5 ed6195aefa00932ba063d5922b2c59c5
BLAKE2b-256 ea564e90f2face0a4ea44c27e32ae9697d6bc526fd6b33d82f82377b254ad80a

See more details on using hashes here.

Provenance

The following attestation bundles were made for conrun-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: conrun-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b49c3f00e275e3b4727d2c7cb5e6c080f74031bb0af376019784d142f29c8f5
MD5 857c6e7543ae9395b1de4649c478363d
BLAKE2b-256 ca31d7b3e5b443f2627f5c4f2ee1d29290b8f97d3ff6f61068a87bbfb97ec5d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for conrun-0.1.3-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