Skip to main content

PyPI Python License

evoid-tasks

Background tasks with lifecycle — Intent Handler system

Quick StartIntent HandlerLifecycleAPI


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

Dependencies

  • evoid>=0.4.0

Links

License

MIT

Release files for evoid-tasks 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for evoid-tasks 0.2.0
File Interpreter ABI Platform
evoid_tasks-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / evoid_tasks-0.2.0-py3-none-any.whl

Download URL evoid_tasks-0.2.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e5a6876cb3754a7709ea3e0dcc4daf353e3f30cb8531431a20b4911edbb7c58
BLAKE2b-256 checksum
How to use checksums
c8d2dd0a186bd27f3411a6e0e03504af143cd153bf4b36ed222403c695989588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page