|
1 | | -# Bootstrap python service |
2 | | -[](https://github.com/febus982/bootstrap-python-fastapi/actions/workflows/ci-pipeline.yml) |
3 | | -[](https://github.com/febus982/bootstrap-python-fastapi/actions/workflows/python-tests.yml) |
4 | | -[](https://codeclimate.com/github/febus982/bootstrap-python-fastapi/test_coverage) |
5 | | -[](https://codeclimate.com/github/febus982/bootstrap-python-fastapi/maintainability) |
6 | | - |
7 | | -[](https://mypy-lang.org/) |
8 | | -[](https://github.com/charliermarsh/ruff) |
9 | | -[](https://github.com/psf/black) |
10 | | -[](https://github.com/PyCQA/bandit) |
11 | | - |
12 | | -This is an example implementation of a python application applying |
13 | | -concepts from [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) |
14 | | -and [SOLID principles](https://en.wikipedia.org/wiki/SOLID). |
15 | | - |
16 | | -* The repository classes are isolated behind interfaces, enforcing the [Interface Segregation principle](https://en.wikipedia.org/wiki/Interface_segregation_principle) |
17 | | - and the [Inversion of Control](https://en.wikipedia.org/wiki/Inversion_of_control) design pattern |
18 | | -* The application frameworks are decoupled from the domain logic |
19 | | -* The storage layer is decoupled from the domain logic |
20 | | - |
21 | | -This template provides out of the box some commonly used functionalities: |
22 | | - |
23 | | -* API Documentation using [FastAPI](https://fastapi.tiangolo.com/) |
24 | | -* Async tasks execution using [Celery](https://docs.celeryq.dev/en/stable/index.html) |
25 | | -* Repository pattern for databases using [SQLAlchemy](https://www.sqlalchemy.org/) and [SQLAlchemy bind manager](https://febus982.github.io/sqlalchemy-bind-manager/stable/) |
26 | | -* Database migrations using [Alembic](https://alembic.sqlalchemy.org/en/latest/) (configured supporting both sync and async SQLAlchemy engines) |
27 | | -* [TODO] Producer and consumer to emit and consume events using [CloudEvents](https://cloudevents.io/) format on [Confluent Kafka](https://docs.confluent.io/kafka-clients/python/current/overview.html) |
28 | | - |
29 | | -## Documentation |
30 | | - |
31 | | -The detailed documentation is available: |
32 | | - |
33 | | -* Online on [GitHub pages](https://febus982.github.io/bootstrap-python-fastapi/) |
34 | | -* Offline by running `make docs` after installing dependencies with `make dev-dependencies` |
35 | | - |
36 | | -## How to use |
37 | | - |
38 | | -Create your GitHub repository using this template (The big green `Use this template` button). |
39 | | -Optionally tweak name and authors in the `pyproject.toml` file, however the metadata |
40 | | -are not used when building the application, nor are referenced anywhere in the code. |
41 | | - |
42 | | -Locally: |
43 | | - |
44 | | -* `make migrate`: Run database migrations |
45 | | -* `make install-dependencies`: Install runtime requirements |
46 | | -* `make dev-dependencies`: Install development requirements |
47 | | -* `make update-dependencies`: Updates requirements |
48 | | -* `make migrate`: Run database migrations |
49 | | -* `make dev`: Run HTTP application with hot reload |
50 | | -* `make test`: Run test suite |
51 | | - |
52 | | -Using Docker: |
53 | | - |
54 | | -* `make containers`: Build containers |
55 | | -* `docker compose run --rm dev make migrate`: Run database migrations |
56 | | -* `docker compose up dev`: Run HTTP application with hot reload |
57 | | -* `docker compose up celery-worker`: Run the celery worker |
58 | | -* `docker compose run --rm test`: Run test suite |
59 | | - |
60 | | -## Other commands for development |
61 | | - |
62 | | -* `make check`: Run tests, code style and lint checks |
63 | | -* `make fix`: Run tests, code style and lint checks with automatic fixes (where possible) |
| 1 | +--8<-- "./README.md" |
0 commit comments