-
Initialise project
poetry install
-
All command after this need to be executed inside poetry shell
poetry shell
-
Install pre-commit hooks
pre-commit install --install-hooks
-
Vscode workspace setting with Pylance extension
{ "python.defaultInterpreterPath": "/home/*/.cache/pypoetry/virtualenvs/rest-template-***/" }
- Development mode
./start.sh
-
Add new python package into project
poetry add <package>
Poetry tend to upgrade unrelated package and its takes a long time to resolve. To avoid it when add/upgrade single package, change the
pyproject.toml
manually and then execute:poetry lock --no-update poetry install
- Migration history
alembic history
- Migrate to latest
alembic upgrade head
- Reset migration
alembic downgrade base
To avoid circular dependencies, here's a guide line of the file hierarchy:
- /config.py
- /utils.py
- /database.py ; /models.py ; /schemas/*
- /services/*
- /routers/* ; /middlewares/*