Design principles¶
The eight rules the codebase keeps to:
- No base classes. No inheritance. No registration. No config files.
- User code is plain functions:
extract(),train(),predict(). - Every public function has typed arguments and a typed return.
- One name, one meaning. No overloaded types.
- Errors tell you what to write, not what went wrong.
- The entire public API fits on one page.
- Each widget is a single public function, no inheritance. Implementation may be split into private
_<widget>_<aspect>.pyhelpers (state, plot, controls) when a widget grows beyond ~200 LOC. Seewidgets/signal.pyplus its_signal_viewer_*.pyhelpers for the canonical pattern. Aim to keep the public entry file under 200 lines and any single helper under ~350. - Immediate-mode rendering. Widget state, when needed, is keyed by widget identity and lives in a private
_<widget>_state.pymodule.
These aren't aesthetic preferences. They're a hard contract: a library small enough to fit in one LLM context window, where every widget is a single function with no class hierarchy.