Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

lite-bootstrap

PyPI version Supported Python versions Downloads Coverage CI License GitHub stars Context7 uv Ruff ty

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:

  • sentry
  • prometheus
  • opentelemetry
  • pyroscope, with OpenTelemetry trace-profile linking
  • structlog
  • cors
  • swagger, including an offline version
  • health-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 same fastapi.FastAPI (or two FastMcpBootstrappers around the same FastMCP) is not supported. The second bootstrapper warns at construction, and its bootstrap() raises ConfigurationError.
  • One OpenTelemetryInstrument per process. bootstrap() calls opentelemetry.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.
  • Failed bootstrap is terminal. If an instrument or application preparation raises, successfully started instruments are torn down in reverse order. Cleanup failures are attached as notes to the original exception. The bootstrapper cannot be reused, and a later teardown() does nothing. Rollback does not undo arbitrary changes made by the instrument that raised.
  • Partial teardown failures are aggregated. If an instrument's teardown raises, the bootstrapper continues with the rest of the instruments and raises TeardownError at the end with all collected failures.

Usage examples:

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 Bootstrapper per 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-bootstrap uses frozen dataclass configs with no pydantic / pydantic-settings runtime dependency, which is what makes it "lite". microbootstrap configures everything through pydantic-settings models.
  • Extras. lite-bootstrap has one mandatory runtime dependency, the pure-Python typing-extensions. Every instrument (sentry, otl, logging, pyroscope) and every framework (fastapi, litestar, faststream, fastmcp) is its own extra, plus an opt-in orjson speedup for logging, per-pair combos (fastapi-sentry, litestar-otl, faststream-metrics, …) and *-all rollups. microbootstrap bundles 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-bootstrap runs on free-threaded CPython 3.14t and 3.15t. Every extra whose dependencies are pure Python installs there. The rest are blocked upstream: orjson and pyroscope have no free-threaded wheels, and otl needs grpcio, so use otl-http instead.
  • Scope. lite-bootstrap only wires instruments. It does not include a Granian server runner or a console writer.

If this project saves you time, consider giving it a star on GitHub.

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 2.0.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lite-bootstrap 2.0.0b1
File Size Uploaded Provenance Actions
lite_bootstrap-2.0.0b1.tar.gz 1.9 MB Without provenance Details for lite_bootstrap-2.0.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lite-bootstrap 2.0.0b1
File Interpreter ABI Platform Actions
lite_bootstrap-2.0.0b1-py3-none-any.whl Python 3 none any Details for lite_bootstrap-2.0.0b1-py3-none-any.whl

Total release size: 3.7 MB

Release files / lite_bootstrap-2.0.0b1.tar.gz

Download URL lite_bootstrap-2.0.0b1.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
9b6e8e0cacbd8698f4d5c372289077ce1072ac99df6929adc388d259b719cc3e
BLAKE2b-256 checksum
How to use checksums
89cc910bd2b936b9b7ea7bfd04e01069383895c0fc1a5eeb4757805523aa9659
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.13 {"installer":{"name":"uv","version":"0.13.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / lite_bootstrap-2.0.0b1-py3-none-any.whl

Download URL lite_bootstrap-2.0.0b1-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4b1d3e090ccdeefd332928b407261550e9b4025603d573cf7df357070f58f1d9
BLAKE2b-256 checksum
How to use checksums
404899b6684e0dda33258c47f6dcc69223eedd944502cb650d38101f374d775b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.13 {"installer":{"name":"uv","version":"0.13.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for lite-bootstrap 2.0.0b1

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page