lite-bootstrap bootstraps a Python microservice with pre-configured observability.
CONTEXT.md owns the vocabulary — read it before naming a concept in code, a test, or
an issue. An instrument being configured versus a bootstrapper being ready, and the two
kinds of skip, are defined there and are load-bearing throughout.
just (task runner) and uv (package manager). The justfile is the source of truth —
just --list, or read it. Every non-obvious recipe carries its intent as a comment.
One file per concern, named for it: instruments/<name>_instrument.py owns one observability
concern, bootstrappers/<framework>_bootstrapper.py owns one framework's bindings, and
import_checker.py owns every optional-dependency probe.
Every link in README.md must be absolute: https://github.com/modern-python/<repo>/blob/main/<path>,
or .../tree/main/<path> for a directory. Never a relative path: README.md is also the PyPI long
description, and PyPI does not rewrite relative links, so a relative one 404s on the package page.
- Issue tracker: GitHub issues on
modern-python/lite-bootstrapviagh.docs/agents/issue-tracker.md. - Triage labels: five canonical roles, each label string equal to its name.
docs/agents/triage-labels.md. - Domain docs: single-context,
CONTEXT.mdanddocs/adr/at the repo root.docs/agents/domain.md.
Four rules that are not visible in the code that follows them:
- No
# noqa: PLR2004. Extract the magic value to a named local instead:expected_max_age = 600; assert config.cors_max_age == expected_max_age. - A public rename ships a silent alias.
OldName = NewNameat the end of the module, re-exported from__init__.pyif the old name was. A class assignment, not a subclass, soisinstancestill holds;OpentelemetryConfigis the worked example. - A warning reached from config construction or an instrument's
bootstrap()goes throughwarn_at_caller. Neither depth is constant — a__post_init__cascade runs as deep as that config's MRO, andbootstrap()sits a frame deeper whenever it callssuper().bootstrap()— so the helper walks out to the first frame outsidelite_bootstrap. The three surviving literalstacklevel=sites lie outside both paths and stay literal; #202 measured them. - Sentinels on a user's app get a
_lite_bootstrap_prefix. A direct attribute on the app object, never a framework namespace like Starlette'sapplication.state. Read it withgetattr(target, name, default)(no SLF violation); write it with# noqa: SLF001.
ty is the only supported type checker; act on its diagnostics alone. The codebase leans on patterns
Pyright reports as errors — conditional imports for optional dependencies, covariant
bootstrap_config narrowing on instrument subclasses, TypedDict optional-key access guarded by
.get() — so adding it yields noise, not findings.
Two suppressions recur and are both correct: invalid-method-override on a framework subclass's
is_configured classmethod, which narrows its parameter type where ty enforces invariance, and
unresolved-attribute on the optional OTel/pyroscope symbols whose guard ty does not follow.