Simple concurrent runner for threads, processes, and async tasks
Project description
conrun
Simple concurrent runner for async tasks, threads and processes – one API, one object.
⚠️ Work-in-progress
conrunis under active development. Untilv1.0the 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→ nativeasyncioconcurrency •thread→ThreadPoolExecutorunder the hood •process→ProcessPoolExecutorfor CPU-bound work - Safe nesting – a single
Runnercan 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13752d577729dd237b448b1516b809091bbea85c25190ef1742d8739a5ed1cff
|
|
| MD5 |
ed6195aefa00932ba063d5922b2c59c5
|
|
| BLAKE2b-256 |
ea564e90f2face0a4ea44c27e32ae9697d6bc526fd6b33d82f82377b254ad80a
|
Provenance
The following attestation bundles were made for conrun-0.1.3.tar.gz:
Publisher:
release.yml on DmitriiKhudiakov/conrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conrun-0.1.3.tar.gz -
Subject digest:
13752d577729dd237b448b1516b809091bbea85c25190ef1742d8739a5ed1cff - Sigstore transparency entry: 251169970
- Sigstore integration time:
-
Permalink:
DmitriiKhudiakov/conrun@db6be258792be513ee058c36ab211d2db5916bf7 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DmitriiKhudiakov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@db6be258792be513ee058c36ab211d2db5916bf7 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b49c3f00e275e3b4727d2c7cb5e6c080f74031bb0af376019784d142f29c8f5
|
|
| MD5 |
857c6e7543ae9395b1de4649c478363d
|
|
| BLAKE2b-256 |
ca31d7b3e5b443f2627f5c4f2ee1d29290b8f97d3ff6f61068a87bbfb97ec5d7
|
Provenance
The following attestation bundles were made for conrun-0.1.3-py3-none-any.whl:
Publisher:
release.yml on DmitriiKhudiakov/conrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conrun-0.1.3-py3-none-any.whl -
Subject digest:
5b49c3f00e275e3b4727d2c7cb5e6c080f74031bb0af376019784d142f29c8f5 - Sigstore transparency entry: 251169979
- Sigstore integration time:
-
Permalink:
DmitriiKhudiakov/conrun@db6be258792be513ee058c36ab211d2db5916bf7 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DmitriiKhudiakov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@db6be258792be513ee058c36ab211d2db5916bf7 -
Trigger Event:
release
-
Statement type: