lite-bootstrap wires production observability (OpenTelemetry, Prometheus, Sentry, and structlog) into FastAPI, Litestar, FastStream, and FastMCP services in a few lines.
With lite-bootstrap, you receive an application with lightweight built-in support for:
sentryprometheusopentelemetrypyroscope, with OpenTelemetry trace-profile linkingstructlogcorsswagger, including an offline versionhealth-checks
Those instruments can be bootstrapped for:
Lifecycle constraints
A few constraints that aren't obvious from the API:
- One bootstrapper per application instance. Constructing two
FastAPIBootstrappers around the samefastapi.FastAPI(or twoFastMcpBootstrappers around the sameFastMCP) is not supported. The second bootstrapper warns at construction, and itsbootstrap()raisesConfigurationError. - One
OpenTelemetryInstrumentper process.bootstrap()callsopentelemetry.trace.set_tracer_provider(...), which the OTel SDK enforces as set-once: later calls log a warning and have no effect.teardown()flushes spans and closes exporters but can't reset the process-global pointer. teardown()is idempotent.BaseBootstrapper.teardown()short-circuits if not bootstrapped; per-instrument teardown methods are safe to call multiple times.- Partial teardown failures are aggregated. If an instrument's teardown raises, the bootstrapper continues with the rest of the instruments and raises
TeardownErrorat the end with all collected failures.
Usage examples:
- with Litestar: litestar-sqlalchemy-template
- with FastAPI: fastapi-sqlalchemy-template
Acknowledgements
lite-bootstrap is inspired by microbootstrap, a single package that wires up the common observability stack (sentry, prometheus, opentelemetry, logging, cors, swagger, health-checks) for FastAPI / Litestar / FastStream services and for plain scripts.
The following ideas were borrowed:
- the overall surface: a
Bootstrapperper framework that composes a set of instruments, - the lifecycle model: each instrument has
bootstrap()/teardown()/is_ready()and is skipped when its optional dependency is not installed, - the catalog of supported instruments and supported frameworks.
The following intentionally differ:
- Configuration.
lite-bootstrapuses frozendataclassconfigs with nopydantic/pydantic-settingsruntime dependency, which is what makes it "lite".microbootstrapconfigures everything throughpydantic-settingsmodels. - Extras.
lite-bootstraphas one mandatory runtime dependency, the pure-Pythontyping-extensions. Every instrument (sentry,otl,logging,pyroscope) and every framework (fastapi,litestar,faststream,fastmcp) is its own extra, plus an opt-inorjsonspeedup for logging, per-pair combos (fastapi-sentry,litestar-otl,faststream-metrics, …) and*-allrollups.microbootstrapbundles the full observability stack (opentelemetry, sentry-sdk, structlog, pyroscope-io, rich, pydantic-settings, …) as base dependencies and only splits framework packages into extras. - Free-threading.
lite-bootstrapruns on free-threaded CPython 3.14t and 3.15t. Every extra whose dependencies are pure Python installs there. The rest are blocked upstream:orjsonandpyroscopehave no free-threaded wheels, andotlneedsgrpcio, so useotl-httpinstead. - Scope.
lite-bootstraponly wires instruments. It does not include a Granian server runner or a console writer.
Links
Part of modern-python
Browse the full list of templates and libraries in
modern-python; the org profile has the categorized index.
Metadata
Release files for lite-bootstrap 1.14.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lite_bootstrap-1.14.1.tar.gz | 1.8 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lite_bootstrap-1.14.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / lite_bootstrap-1.14.1.tar.gz
| Download URL | lite_bootstrap-1.14.1.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37852d555280b2b5cb1ae186431632e24542e5e6e766b8e4059bc90d19cf31bd
|
|
BLAKE2b-256 checksum How to use checksums |
15a541a269cae9b1fe76235599440f07c5fc21f09a00f58adcac58aea524a594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / lite_bootstrap-1.14.1-py3-none-any.whl
| Download URL | lite_bootstrap-1.14.1-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e07f31c2145549f8ce01b6d8b25b0171ec77649380a34d607461987e8b16fcb
|
|
BLAKE2b-256 checksum How to use checksums |
0f7d1129db1c9977623cb2eb1e17bfc717d50d44d7bd1f689012ec54f2508257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for lite-bootstrap 1.14.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.