A template Python
project implemented using hexagonal architecture with a YAML
Pythonic config, SQLAlchemy PostgreSQL
DB and FastAPI
- the basics to get most projects up and running in no time.
Things to know to get up and running.
- Run the application using either the local or
Docker
approach. - See the
./configs/
directory to modify the behaviour of the application. - Interact with the application in your browser at: http://localhost:8080/docs
Setting up our environment
poetry install
poetry shell
python -m src --env <choice>
See python -m src -h
for a list of choices.
docker compose up
To be setup before commiting any code.
Setup and run the pre-commit (uses .pre-commit-config.yaml):
pre-commit install
pre-commit run --all-files
The above needs to be performed from within the virtual environment.
python scripts/run_migration.py --env local
- Create
Alembic
migrations for table changes.
- Create
- Add GitHub actions
- Have other branches with less should one want to start from a smaller footprint than this
- Update pre-commit to use ruff - see FastApi tutorial for Pull Request
- Update to SQLAlchemy v2
- See FastApi template repo for other tips and tricks
- pscopy parse in argument in pyprojects.toml
- init.sql to work with .env variable - see phoen stack overflow
- Have the repetitive part of my README in a gist?
- Add coverages reports
- Add tests
- Parse in logging level from config to logger
- Better FastAPI exception handling: @app.exception_handler(Error) # async def error_handler(_: Request, e: Error):
- Add tracebacks to logging
- Use dependabot