Skip to content

Commit 805677d

Browse files
committed
update docs
1 parent 5f1a5db commit 805677d

File tree

8 files changed

+256
-12
lines changed

8 files changed

+256
-12
lines changed

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,27 @@ Lite-Bootstrap
66
[![downloads](https://img.shields.io/pypi/dm/lite-bootstrap.svg)](https://pypistats.org/packages/lite-bootstrap)
77
[![GitHub stars](https://img.shields.io/github/stars/modern-python/lite-bootstrap)](https://github.com/modern-python/lite-bootstrap/stargazers)
88

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

11-
## Quickstart:
12-
### Installation
11+
With `lite-bootstrap`, you receive an application with lightweight built-in support for:
12+
- `sentry`
13+
- `prometheus`
14+
- `opentelemetry`
15+
- `structlog`
16+
- `cors`
17+
- `swagger` - with additional offline version support
18+
- `health-checks`
1319

14-
```shell
15-
$ pip install lite-bootstrap
16-
```
20+
Those instruments can be bootstrapped for:
21+
22+
1. LiteStar
23+
2. FastStream
24+
3. FastAPI
25+
4. services and scripts without frameworks
26+
---
27+
28+
## 📚 [Documentation](https://lite-bootstrap.readthedocs.io)
29+
30+
## 📦 [PyPi](https://pypi.org/project/lite-bootstrap)
31+
32+
## 📝 [License](LICENSE)

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ With `lite-bootstrap`, you receive an application with lightweight built-in supp
1414
- `health-checks`
1515

1616
Those instruments can be bootstrapped for:
17-
- `fastapi`,
18-
- `litestar`,
19-
- `faststream`,
20-
- services without these frameworks.
2117

18+
1. [LiteStar](integrations/litestar)
19+
2. [FastStream](integrations/faststream)
20+
3. [FastAPI](integrations/fastapi)
21+
4. [services and scripts without frameworks](integrations/free)
2222
---

docs/integrations/fastapi.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Usage with `Fastapi`
2+
3+
*Another example of usage with FastAPI - [fastapi-sqlalchemy-template](https://github.com/modern-python/fastapi-sqlalchemy-template)*
4+
5+
## 1. Install `lite-bootstrapp[fastapi-all]`:
6+
7+
=== "uv"
8+
9+
```bash
10+
uv add lite-bootstrapp[fastapi-all]
11+
```
12+
13+
=== "pip"
14+
15+
```bash
16+
pip install lite-bootstrapp[fastapi-all]
17+
```
18+
19+
=== "poetry"
20+
21+
```bash
22+
poetry add lite-bootstrapp[fastapi-all]
23+
```
24+
25+
Read more about available extras [here](../../introduction/installation):
26+
27+
## 2. Define bootstrapper config and build you application:
28+
29+
```python
30+
from lite_bootstrap import FastAPIConfig, FastAPIBootstrapper
31+
32+
33+
bootstrapper_config = FastAPIConfig(
34+
service_name="microservice",
35+
service_version="2.0.0",
36+
service_environment="test",
37+
service_debug=False,
38+
cors_allowed_origins=["http://test"],
39+
health_checks_path="/custom-health/",
40+
opentelemetry_endpoint="otl",
41+
prometheus_metrics_path="/custom-metrics/",
42+
sentry_dsn="https://testdsn@localhost/1",
43+
swagger_offline_docs=True,
44+
)
45+
bootstrapper = FastAPIBootstrapper(bootstrapper_config)
46+
application = bootstrapper.bootstrap()
47+
```

docs/integrations/faststream.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Usage with `FastStream`
2+
3+
## 1. Install `lite-bootstrapp[faststream-all]`:
4+
5+
=== "uv"
6+
7+
```bash
8+
uv add lite-bootstrapp[faststream-all]
9+
```
10+
11+
=== "pip"
12+
13+
```bash
14+
pip install lite-bootstrapp[faststream-all]
15+
```
16+
17+
=== "poetry"
18+
19+
```bash
20+
poetry add lite-bootstrapp[faststream-all]
21+
```
22+
23+
Read more about available extras [here](../../introduction/installation):
24+
25+
## 2. Define bootstrapper config and build you application:
26+
27+
```python
28+
from lite_bootstrap import FastStreamConfig, FastStreamBootstrapper
29+
from faststream.redis.opentelemetry import RedisTelemetryMiddleware
30+
from faststream.redis.prometheus import RedisPrometheusMiddleware
31+
from faststream.redis import RedisBroker
32+
33+
34+
broker = RedisBroker()
35+
bootstrapper_config = FastStreamConfig(
36+
service_name="microservice",
37+
service_version="2.0.0",
38+
service_environment="test",
39+
service_debug=False,
40+
opentelemetry_endpoint="otl",
41+
opentelemetry_middleware_cls=RedisTelemetryMiddleware,
42+
prometheus_metrics_path="/custom-metrics/",
43+
prometheus_middleware_cls=RedisPrometheusMiddleware,
44+
sentry_dsn="https://testdsn@localhost/1",
45+
health_checks_path="/custom-health/",
46+
logging_buffer_capacity=0,
47+
broker=broker,
48+
)
49+
bootstrapper = FastStreamBootstrapper(bootstrapper_config)
50+
application = bootstrapper.bootstrap()
51+
```

docs/integrations/free.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Usage without frameworks
2+
3+
## 1. Install `lite-bootstrapp[free-all]`:
4+
5+
=== "uv"
6+
7+
```bash
8+
uv add lite-bootstrapp[free-all]
9+
```
10+
11+
=== "pip"
12+
13+
```bash
14+
pip install lite-bootstrapp[free-all]
15+
```
16+
17+
=== "poetry"
18+
19+
```bash
20+
poetry add lite-bootstrapp[free-all]
21+
```
22+
23+
Read more about available extras [here](../../introduction/installation):
24+
25+
## 2. Define bootstrapper config and build you application:
26+
27+
```python
28+
from lite_bootstrap import FreeBootstrapperConfig, FreeBootstrapper
29+
30+
31+
bootstrapper_config = FreeBootstrapperConfig(
32+
service_debug=False,
33+
opentelemetry_endpoint="otl",
34+
sentry_dsn="https://testdsn@localhost/1",
35+
)
36+
bootstrapper = FreeBootstrapper(bootstrapper_config)
37+
bootstrapper.bootstrap()
38+
```

docs/integrations/litestar.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Usage with `Litestar`
2+
3+
*Another example of usage with LiteStar - [litestar-sqlalchemy-template](https://github.com/modern-python/litestar-sqlalchemy-template)*
4+
5+
## 1. Install `lite-bootstrap[litestar-all]`:
6+
7+
=== "uv"
8+
9+
```bash
10+
uv add lite-bootstrapp[litestar-all]
11+
```
12+
13+
=== "pip"
14+
15+
```bash
16+
pip install lite-bootstrapp[litestar-all]
17+
```
18+
19+
=== "poetry"
20+
21+
```bash
22+
poetry add lite-bootstrapp[litestar-all]
23+
```
24+
25+
Read more about available extras [here](../introduction/installation):
26+
27+
## 2. Define bootstrapper config and build you application:
28+
29+
```python
30+
from lite_bootstrap import LitestarConfig, LitestarBootstrapper
31+
32+
33+
bootstrapper_config = LitestarConfig(
34+
service_name="microservice",
35+
service_version="2.0.0",
36+
service_environment="test",
37+
service_debug=False,
38+
cors_allowed_origins=["http://test"],
39+
health_checks_path="/custom-health/",
40+
opentelemetry_endpoint="otl",
41+
prometheus_metrics_path="/custom-metrics/",
42+
sentry_dsn="https://testdsn@localhost/1",
43+
swagger_offline_docs=True,
44+
)
45+
bootstrapper = LitestarBootstrapper(bootstrapper_config)
46+
application = bootstrapper.bootstrap()
47+
```

docs/introduction/installation.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Installation
2+
3+
## Choose suitable extras
4+
5+
You can choose required framework and instruments using this table:
6+
7+
| Instrument | Litestar | Faststream | FastAPI | Free Bootstrapper, without framework |
8+
|---------------|--------------------|----------------------|-------------------|--------------------------------------|
9+
| sentry | `litestar-sentry` | `faststream-sentry` | `fastapi-sentry` | `sentry` |
10+
| prometheus | `litestar-metrics` | `faststream-metrics` | `fastapi-metrics` | not used |
11+
| opentelemetry | `litestar-otl` | `faststream-otl` | `fastapi-otl` | `otl` |
12+
| structlog | `litestar-logging` | `faststream-logging` | `fastapi-logging` | `logging` |
13+
| cors | no extra | not used | no extra | not used |
14+
| swagger | no extra | not used | no extra | not used |
15+
| health-checks | no extra | no extra | no extra | not used |
16+
| all | `litestar-all` | `faststream-all` | `fastapi-all` | `free-all` |
17+
18+
* not used - means that the instrument is not implemented in the integration.
19+
* no extra - means that the instrument requires no additional dependencies.
20+
21+
## Install `lite-bootstrap` using your favorite tool with choosen extras
22+
23+
For example, if you want to bootstrap litestar with structlog and opentelemetry instruments:
24+
25+
=== "uv"
26+
27+
```bash
28+
uv add lite-bootstrapp[litestar-logging,litestar-otl]
29+
```
30+
31+
=== "pip"
32+
33+
```bash
34+
pip install lite-bootstrapp[litestar-logging,litestar-otl]
35+
```
36+
37+
=== "poetry"
38+
39+
```bash
40+
poetry add lite-bootstrapp[litestar-logging,litestar-otl]
41+
```

mkdocs.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ repo_url: https://github.com/modern-python/lite-bootstrap
33
docs_dir: docs
44
edit_uri: edit/main/docs/
55
nav:
6-
- Quick-Start: index.md
7-
6+
- Introduction:
7+
- Installation: introduction/installation.md
8+
- Integrations:
9+
- Litestar: integrations/litestar.md
10+
- FastStream: integrations/faststream.md
11+
- FastAPI: integrations/fastapi.md
812
theme:
913
name: material
1014
features:

0 commit comments

Comments
 (0)