Lite package for bootstrapping new microservices
Project description
Lite-Bootstrap
lite-bootstrap assists you in creating applications with all the necessary instruments already set up.
With lite-bootstrap, you receive an application with lightweight built-in support for:
sentryprometheusopentelemetrypyroscope- with OpenTelemetry trace-profile linkingstructlogcorsswagger- with additional offline version supporthealth-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) stacks teardown hooks and re-wraps the lifespan. The library warns and skips the second attachment, but the second bootstrapper'steardown()won't fire on ASGI shutdown. - One
OpenTelemetryInstrumentper process.bootstrap()callsopentelemetry.trace.set_tracer_provider(...), which the OTel SDK enforces as set-once — subsequent 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
Part of modern-python
Browse the full list of templates and libraries in
modern-python — see the org profile for the
categorized index.
📚 Documentation
📦 PyPi
📝 License
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 (nopydantic/pydantic-settingsruntime dependency), which is what makes it "lite".microbootstrapconfigures everything throughpydantic-settingsmodels. - Granular extras:
lite-bootstrapships onlyorjsonas a runtime dependency; every instrument (sentry,otl,logging,pyroscope) and every framework (fastapi,litestar,faststream) is its own extra, with per-pair combos (fastapi-sentry,litestar-otl,faststream-metrics, …) and*-allrollups. You install only what you actually use.microbootstrapbundles the full observability stack (opentelemetry, sentry-sdk, structlog, pyroscope-io, rich, pydantic-settings, …) as base dependencies and only splits framework packages into extras. - Scope:
lite-bootstrapis deliberately narrow — only instrument wiring. It does not include a Granian server runner or a console writer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lite_bootstrap-1.1.0.tar.gz.
File metadata
- Download URL: lite_bootstrap-1.1.0.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49129f364ec645adb1249482ca4af21e7a6dc900342b2d0f5368319b1ab485dc
|
|
| MD5 |
a4f1be7dee549ad27ef6c02f5d66a6a3
|
|
| BLAKE2b-256 |
563c923a1b55bfc6856ec4c3990a2c6f0cb819908e36603ed770fc254521e4fd
|
File details
Details for the file lite_bootstrap-1.1.0-py3-none-any.whl.
File metadata
- Download URL: lite_bootstrap-1.1.0-py3-none-any.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1061d49246c6fedf227b03cbc0d03d6f4ac1a739309733ce8b36a6c7ff4bdfd
|
|
| MD5 |
7757e9b48d7fc18ff8140044aa39e0d0
|
|
| BLAKE2b-256 |
5ea41b1d61a3e0907c2f2e53f69d129c414dff498d83827bc28e7868c3e52c14
|