Python Examples
Worked end-to-end examples for the Cloaca Python bindings.
- Basic Workflow — a complete
end-to-end example: define tasks with
@cloaca.task, build a workflow, run it viaDefaultRunner.execute(), and inspect the result.
The example library here is intentionally small. For broader coverage, use the dedicated tracks:
- Python Tutorials — the step-by-step learning path: first workflow, context handling, complex workflows, error handling, multi-tenancy, cron scheduling, event triggers, packaged workflows, computation graphs, accumulators.
- Python How-To Guides — task-oriented recipes: testing workflows, performance optimization, packaging Python workflows, backend selection.
- Python API Reference —
the full surface for
cloaca’s decorators, types, and runner configuration. - The repo’s
examples/tutorials/python/directory — runnable sources for every Python tutorial, kept in lockstep with the prose.
If you need an example that isn’t covered by any of the above, opening an issue with the use case is the most direct path to a new tutorial or guide.
# Install Python bindings
pip install cloaca[sqlite] # or cloaca[postgres]
import cloaca
# SQLite for development
runner = cloaca.DefaultRunner("sqlite:///examples.db")
# PostgreSQL for production
runner = cloaca.DefaultRunner("postgresql://user:pass@localhost:5432/cloacina")
- Tutorials — step-by-step learning.
- How-to Guides — problem-solving recipes.
- API Reference — complete API documentation.
- Repository examples — source code.