Examples¶
Small, focused opendataframework projects, each isolating exactly one
core abstraction, with runnable code you can read end-to-end. They live in
examples/
in the repo; each has its own README.md with a full walkthrough. Read
1–10 in order — each one builds on ideas from the last.
| # | Example | Concept(s) | Docs |
|---|---|---|---|
| 1 | 01-entity-repository/ |
Entity + Repository, backed by a SQLite @Component. The smallest possible data layer — no Service, no UI. |
Entity, Repository |
| 2 | 02-component-and-context/ |
Two Components with a constructor dependency, showing the Context's dependency-ordered on_start()/on_stop() lifecycle. |
Component, Context |
| 3 | 03-service/ |
A Heartbeat Service: setup() → run() → stop(), run() backgrounded by the framework. Deliberately not an API server. |
Service |
| 4 | 04-task-and-pipeline/ |
Two Tasks composed into a Pipeline that coordinates them, run explicitly via project.context.get(...).execute(). |
Task, Pipeline |
| 5 | 05-layer/ |
Components split across two Layers (@Storage, @Analytics), read back through project.context.get(cls). |
Layer |
| 6 | 06-logger-and-view/ |
A Repository with an injected logger: Logger and data_view()/field() (View) — per-component logging and self-describing data representation. |
Logger, View |
| 7 | 07-config-environments/ |
Same app/ code, two config directories (config/dev/, config/prod/) — no environment flag, just a different path. |
Config |
| 8 | 08-function/ |
Plain functions made framework-aware with Function: called by key through project.context.call(...) with an injected @Component, injected into a @Task, and still callable directly, unchanged. |
Function |
| 9 | 09-agent/ |
A Librarian Agent: handed a question through project.context.call(...), it works towards an answer step by step, acting on an injected @Component. The model is a rule-based stand-in — no provider, no API key. |
Agent |
| 10 | 10-events/ |
Components declaring events: Events watch a Pipeline run: a call tree built from each call's parent, failures queued for a Service to send, and Function calls counted with a protocol filter. |
Events |
| 11 | 11-notifications/ |
A @Publisher Task publishes orders.received through an injected notifications: Notifications; a @Subscriber Component reacts by calling a Function, a background one counts orders.*, and main.py shows toasts and the trace from the publish to every reaction. |
Notifications |
Every example is self-contained: config.toml (or a config/ directory)
plus an app/ package, runnable with python main.py from inside the
example's own directory. None of them add third-party dependencies beyond
opendataframework itself and the Python standard library.
Looking for the CLI, UI, MCP, or chat?
Those, and the full DataView catalog, are out of scope here on purpose — see the
odf package's own examples/ instead,
which depends on opendataframework and demonstrates that surface.