evoid-tasks
Background tasks with lifecycle — Intent Handler system
Quick Start • Intent Handler • Lifecycle • API
Quick Start
uv add evoid-tasks
Method 1: Intent Handler (Recommended)
from evoid_tasks import register_handlers
# Register task scheduler as Intent handlers
register_handlers(max_concurrent=10)
Method 2: Direct API
from evoid_tasks import scheduler
# Fire and forget
scheduler.run(send_email, to="alice@example.com")
# Periodic tasks
@scheduler.task(interval=60)
async def cleanup(ctx):
await delete_old_sessions()
Intent Handler
evoid-tasks registers task scheduling as Intent handlers.
Lifecycle (Godot-inspired)
from evoid_tasks import scheduler, TaskContext
@scheduler.task(interval=10)
async def my_task(ctx: TaskContext):
# on_start — called once
print(f"Task {ctx.task_name} started")
# on_tick — called every interval
print(f"Tick {ctx.tick}, delta={ctx.delta}")
# on_stop — called on cancellation
# on_error — called on exception
Configuration
TOML
[engines]
tasks = "tasks"
[engines.options.tasks]
max_concurrent = 10
API
register_handlers(max_concurrent: int = 10)
Register task scheduler as Intent handlers.
Scheduler Methods
| Method | Signature | Description |
|---|---|---|
run |
run(func, *args, **kwargs) |
Fire-and-forget background task |
task |
@task(interval=N) |
Decorator for periodic tasks |
on |
@on(event) |
Listen for named events |
emit |
emit(event, data) |
Emit event to all handlers |
cancel |
cancel(task_def) |
Cancel a running task |
shutdown |
shutdown() |
Cancel all tasks |
DI Integration
All plugins register with evoid-di for automatic service discovery and fault tolerance.
from evoid_di import di
# Resolve with fallback
storage = di.resolve_with_fallback("storage.postgresql")
# Tries: postgresql → sqlite → redis → cluster peers → None
Dependencies
evoid>=0.4.0
Links
License
MIT
Release files for evoid-tasks 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| evoid_tasks-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / evoid_tasks-0.1.2-py3-none-any.whl
| Download URL | evoid_tasks-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f5cf7301a18e689fec76fc716e916e3ad36e285d0dea349cb6739fdb8950ab1
|
|
BLAKE2b-256 checksum How to use checksums |
0a5f6e730abe4434b445a853a495f5b1c801108dd3aa3bb0c611e7032b859900
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|