Skip to content

Commit 89e25cd

Browse files
authored
Merge pull request #32 from modern-python/9-add-documentation
add docs initial structure
2 parents b6ab5c7 + 7ff36a6 commit 89e25cd

File tree

13 files changed

+502
-7
lines changed

13 files changed

+502
-7
lines changed

.readthedocs.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "3.10"
7+
8+
python:
9+
install:
10+
- requirements: docs/requirements.txt
11+
12+
mkdocs:
13+
configuration: mkdocs.yml

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/css/code.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Round the corners of code blocks */
2+
.md-typeset .highlight code {
3+
border-radius: 10px !important;
4+
}
5+
6+
@media (max-width: 600px) {
7+
.md-typeset code {
8+
border-radius: 4px;
9+
}
10+
}

docs/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Lite Bootstrap
2+
3+
Welcome to the `lite-bootstrap` documentation!
4+
5+
`lite-bootstrap` assists you in creating applications with all the necessary instruments already set up.
6+
7+
With `lite-bootstrap`, you receive an application with lightweight built-in support for:
8+
- `sentry`
9+
- `prometheus`
10+
- `opentelemetry`
11+
- `structlog`
12+
- `cors`
13+
- `swagger` - with additional offline version support
14+
- `health-checks`
15+
16+
Those instruments can be bootstrapped for:
17+
18+
- [LiteStar](integrations/litestar)
19+
- [FastStream](integrations/faststream)
20+
- [FastAPI](integrations/fastapi)
21+
- [services and scripts without frameworks](integrations/free)
22+
---

docs/integrations/fastapi.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
```
48+
49+
Read more about available configuration options [here](../../../introduction/configuration):

docs/integrations/faststream.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
```
52+
53+
Read more about available configuration options [here](../../../introduction/configuration):

docs/integrations/free.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
```
39+
40+
Read more about available configuration options [here](../../../introduction/configuration):

docs/integrations/litestar.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
```
48+
49+
Read more about available configuration options [here](../../../introduction/configuration):

0 commit comments

Comments
 (0)