AsyncIO Task Runner (Coro Runner)
The AsyncIO Task Runner (Coro Runner) is a Python utility designed for managing concurrent asynchronous tasks using the built-in asyncio module. It provides an efficient way to execute multiple tasks in a single-threaded environment with customizable concurrency limits.
This project leverages asyncio (introduced in Python 3.4) to simplify handling of asynchronous workloads, making it ideal for lightweight, scalable applications.
Features
- Configurable Concurrency: Define the number of concurrent tasks when initializing the runner.
- Efficient Task Management: Run multiple tasks concurrently with streamlined execution control.
- Worker Queue: Multiple queue can be configued along with their priority.
Planned Enhancements
- Monitoring Tool Integration: Support for real-time task monitoring and analytics.
- Low-Level API: Features such as callbacks, acknowledgments, and error handling for advanced use cases.
- Robust Logging: Detailed logging to track task execution and debug issues.
Getting Started
Installation
To install coro-runner, use pip:
pip install coro-runner
Full documentation
Quickstart
-
Define and schedule tasks:
from coro_runner import CoroRunner runner = CoroRunner(concurrency=10) # Add your tasks from anywhere b runner.add_task(your_task, args=[1,2,3], kwargs={"test": "OK!"}) # your_task must be a async function
Declare the runner once and call from everywhere.
Prerequisites
- Python 3.12 or later
- Poetry for dependency management
Installation and Setup
-
Clone the repository:
git clone https://github.com/iashraful/async-coro-runner.git cd async-coro-runner
-
Activate the virtual environment:
poetry shell -
Install dependencies:
poetry install
Running Tests
Run the test suite to verify the setup:
pytest -s
Sample Output:
Task started: Task-1
Task ended: Task-1
...
Example Usage
The project includes an example API implemented with FastAPI. It demonstrates how to use the task runner to manage asynchronous tasks.
Starting the API
-
Run the API server:
uvicorn example:app --reload
-
Trigger tasks using the endpoint:
GET /fire-task?count=25
How to Contribute
Contributions are welcome! Follow these steps to get started:
- Fork the repository and create a new branch for your feature or bug fix.
- Write tests for your changes.
- Open a pull request with a clear description of your contribution.
Metadata
Release files for coro-runner 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coro_runner-0.2.7.tar.gz | 11.0 kB | Without provenance | Details for coro_runner-0.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coro_runner-0.2.7-py3-none-any.whl | Python 3 | none | any | Details for coro_runner-0.2.7-py3-none-any.whl |
Total release size: 23.7 kB
Release files / coro_runner-0.2.7.tar.gz
| Download URL | coro_runner-0.2.7.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e62853eeb9a4bb12da54173c7ad7192c4114dc754b65a7928cfc3c8ebbb566d7
|
|
BLAKE2b-256 checksum How to use checksums |
f1e92f91b122186b55612178bb1bddb51d59fa7694fc87497b41b6feb0f88513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Release files / coro_runner-0.2.7-py3-none-any.whl
| Download URL | coro_runner-0.2.7-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c61e275d293ec988b6266f99f539903edf8282a9c8a55f9e24e0e5f752b6de8e
|
|
BLAKE2b-256 checksum How to use checksums |
0fedbc62fd5624cbc1d7db833676f520720f6db8019d5aa76201b5409fcbf524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Security for coro-runner 0.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.