Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.10"

python:
install:
- requirements: docs/requirements.txt

mkdocs:
configuration: mkdocs.yml
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@ Lite-Bootstrap
[![downloads](https://img.shields.io/pypi/dm/lite-bootstrap.svg)](https://pypistats.org/packages/lite-bootstrap)
[![GitHub stars](https://img.shields.io/github/stars/modern-python/lite-bootstrap)](https://github.com/modern-python/lite-bootstrap/stargazers)

This package helps to build new microservices
`lite-bootstrap` assists you in creating applications with all the necessary instruments already set up.

## Quickstart:
### Installation
With `lite-bootstrap`, you receive an application with lightweight built-in support for:
- `sentry`
- `prometheus`
- `opentelemetry`
- `structlog`
- `cors`
- `swagger` - with additional offline version support
- `health-checks`

```shell
$ pip install lite-bootstrap
```
Those instruments can be bootstrapped for:

1. LiteStar
2. FastStream
3. FastAPI
4. services and scripts without frameworks
---

## 📚 [Documentation](https://lite-bootstrap.readthedocs.io)

## 📦 [PyPi](https://pypi.org/project/lite-bootstrap)

## 📝 [License](LICENSE)
10 changes: 10 additions & 0 deletions docs/css/code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Round the corners of code blocks */
.md-typeset .highlight code {
border-radius: 10px !important;
}

@media (max-width: 600px) {
.md-typeset code {
border-radius: 4px;
}
}
22 changes: 22 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Lite Bootstrap

Welcome to the `lite-bootstrap` documentation!

`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:
- `sentry`
- `prometheus`
- `opentelemetry`
- `structlog`
- `cors`
- `swagger` - with additional offline version support
- `health-checks`

Those instruments can be bootstrapped for:

- [LiteStar](integrations/litestar)
- [FastStream](integrations/faststream)
- [FastAPI](integrations/fastapi)
- [services and scripts without frameworks](integrations/free)
---
49 changes: 49 additions & 0 deletions docs/integrations/fastapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Usage with `Fastapi`

*Another example of usage with FastAPI - [fastapi-sqlalchemy-template](https://github.com/modern-python/fastapi-sqlalchemy-template)*

## 1. Install `lite-bootstrapp[fastapi-all]`:

=== "uv"

```bash
uv add lite-bootstrapp[fastapi-all]
```

=== "pip"

```bash
pip install lite-bootstrapp[fastapi-all]
```

=== "poetry"

```bash
poetry add lite-bootstrapp[fastapi-all]
```

Read more about available extras [here](../../../introduction/installation):

## 2. Define bootstrapper config and build you application:

```python
from lite_bootstrap import FastAPIConfig, FastAPIBootstrapper


bootstrapper_config = FastAPIConfig(
service_name="microservice",
service_version="2.0.0",
service_environment="test",
service_debug=False,
cors_allowed_origins=["http://test"],
health_checks_path="/custom-health/",
opentelemetry_endpoint="otl",
prometheus_metrics_path="/custom-metrics/",
sentry_dsn="https://testdsn@localhost/1",
swagger_offline_docs=True,
)
bootstrapper = FastAPIBootstrapper(bootstrapper_config)
application = bootstrapper.bootstrap()
```

Read more about available configuration options [here](../../../introduction/configuration):
53 changes: 53 additions & 0 deletions docs/integrations/faststream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Usage with `FastStream`

## 1. Install `lite-bootstrapp[faststream-all]`:

=== "uv"

```bash
uv add lite-bootstrapp[faststream-all]
```

=== "pip"

```bash
pip install lite-bootstrapp[faststream-all]
```

=== "poetry"

```bash
poetry add lite-bootstrapp[faststream-all]
```

Read more about available extras [here](../../../introduction/installation):

## 2. Define bootstrapper config and build you application:

```python
from lite_bootstrap import FastStreamConfig, FastStreamBootstrapper
from faststream.redis.opentelemetry import RedisTelemetryMiddleware
from faststream.redis.prometheus import RedisPrometheusMiddleware
from faststream.redis import RedisBroker


broker = RedisBroker()
bootstrapper_config = FastStreamConfig(
service_name="microservice",
service_version="2.0.0",
service_environment="test",
service_debug=False,
opentelemetry_endpoint="otl",
opentelemetry_middleware_cls=RedisTelemetryMiddleware,
prometheus_metrics_path="/custom-metrics/",
prometheus_middleware_cls=RedisPrometheusMiddleware,
sentry_dsn="https://testdsn@localhost/1",
health_checks_path="/custom-health/",
logging_buffer_capacity=0,
broker=broker,
)
bootstrapper = FastStreamBootstrapper(bootstrapper_config)
application = bootstrapper.bootstrap()
```

Read more about available configuration options [here](../../../introduction/configuration):
40 changes: 40 additions & 0 deletions docs/integrations/free.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Usage without frameworks

## 1. Install `lite-bootstrapp[free-all]`:

=== "uv"

```bash
uv add lite-bootstrapp[free-all]
```

=== "pip"

```bash
pip install lite-bootstrapp[free-all]
```

=== "poetry"

```bash
poetry add lite-bootstrapp[free-all]
```

Read more about available extras [here](../../../introduction/installation):

## 2. Define bootstrapper config and build you application:

```python
from lite_bootstrap import FreeBootstrapperConfig, FreeBootstrapper


bootstrapper_config = FreeBootstrapperConfig(
service_debug=False,
opentelemetry_endpoint="otl",
sentry_dsn="https://testdsn@localhost/1",
)
bootstrapper = FreeBootstrapper(bootstrapper_config)
bootstrapper.bootstrap()
```

Read more about available configuration options [here](../../../introduction/configuration):
49 changes: 49 additions & 0 deletions docs/integrations/litestar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Usage with `Litestar`

*Another example of usage with LiteStar - [litestar-sqlalchemy-template](https://github.com/modern-python/litestar-sqlalchemy-template)*

## 1. Install `lite-bootstrap[litestar-all]`:

=== "uv"

```bash
uv add lite-bootstrapp[litestar-all]
```

=== "pip"

```bash
pip install lite-bootstrapp[litestar-all]
```

=== "poetry"

```bash
poetry add lite-bootstrapp[litestar-all]
```

Read more about available extras [here](../../../introduction/installation):

## 2. Define bootstrapper config and build you application:

```python
from lite_bootstrap import LitestarConfig, LitestarBootstrapper


bootstrapper_config = LitestarConfig(
service_name="microservice",
service_version="2.0.0",
service_environment="test",
service_debug=False,
cors_allowed_origins=["http://test"],
health_checks_path="/custom-health/",
opentelemetry_endpoint="otl",
prometheus_metrics_path="/custom-metrics/",
sentry_dsn="https://testdsn@localhost/1",
swagger_offline_docs=True,
)
bootstrapper = LitestarBootstrapper(bootstrapper_config)
application = bootstrapper.bootstrap()
```

Read more about available configuration options [here](../../../introduction/configuration):
Loading
Loading