Skip to content

DmitriiKhudiakov/conrun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Concurrent task runner

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages