bootstrap¶
otto’s composition root: repo discovery + contained user-code registration.
Replaces config’s import-time side effects. Phase 1 (discovery)
parses the environment and repo settings.toml files — no user code runs.
Between phase 1 and phase 2 the dependency pass (config.dependencies)
validates each repo’s declared dependencies, skips repos whose required deps
are unsatisfied (framed DependencyErrors), and orders phase-2 registration
topologically (stable — sut-dir order when no deps are declared). Phase 2
(registration) imports each repo’s init modules and test files, wrapping
every user-module exec so one broken file becomes a framed
BootstrapError instead of bricking the process. Lab loading is
deliberately NOT part of bootstrap — it happens lazily at first access.
bootstrap() is idempotent: the CLI entrypoint calls it before argv
parsing, open_context() calls it lazily, and repeated calls return the
same BootstrapResult.
- exception otto.bootstrap.BootstrapError(sut_dir: Any, source: str, cause: BaseException)¶
Bases:
ExceptionOne user file failed to load during bootstrap registration.
- exception otto.bootstrap.DependencyError(sut_dir: Any, message: str)¶
Bases:
BootstrapErrorA repo’s declared dependencies cannot be satisfied (or a dependency was skipped).
- class otto.bootstrap.BootstrapWarning(sut_dir: Any, message: str)¶
Bases:
objectA non-fatal dependency finding: rendered at startup, never gates dispatch.
- class otto.bootstrap.BootstrapResult(env: OttoEnvSettings, repos: list[Repo], errors: list[~otto.bootstrap.BootstrapError] = <factory>, warnings: list[~otto.bootstrap.BootstrapWarning] = <factory>)¶
Bases:
objectEverything bootstrap produced: environment, repos, contained errors.
- env : OttoEnvSettings¶
- errors : list[BootstrapError]¶
- warnings : list[BootstrapWarning]¶
- otto.bootstrap.discover() tuple[OttoEnvSettings, list[Repo]]¶
Phase 1: env + repo discovery (settings parse only — no user code). Cached.
Per-repo config-data failures (unreadable or malformed
settings.toml) get the same containment as phase-2 user-code failures: the repo is skipped and a framedBootstrapErroris recorded, surfacing viabootstrap().errors(help degrades, real dispatch fails loud). Env-level failures (badOTTO_SUT_DIRS/ OTTO_* values) still raise — with no environment there is nothing to degrade to.
- otto.bootstrap.bootstrap() BootstrapResult¶
Run the composition root (idempotent): discovery, dependency pass, registration.