Skip to content

devbruce/fastapi-di-tpl

Repository files navigation

FastAPI with Dependency Injector

github-action release
python fastapi dependency-injector

Note

This repository is a template of FastAPI with Dependency Injector

📖 How to Set Local Environment

🛠️ Prerequisites


✔️ Set Environment Variables

Copy .envrc.tpl to .envrc for setting environment variables with direnv

cp .envrc.tpl .envrc
direnv allow

✔️ Create Virtual Environment with Poetry

  • Install python with pyenv
pyenv install ${PYTHON_VERSION}
  • Set poetry config
poetry config virtualenvs.in-project true
  • Create virtualenv(.venv) with poetry
poetry env use $(pyenv root)/versions/${PYTHON_VERSION}/bin/python
poetry install
  • Activate virtualenv(.venv)

Ref: managing-environments#activating-the-environment

eval $(poetry env activate)
poetry shell

✔️ Install pre-commit Hooks(.git/hooks)

pre-commit: Link

pre-commit install -t pre-commit
pre-commit install -t pre-push

🖱️ Run Manually
pre-commit run

🖱️ How to Skip Hooks

After installing the hooks, you can use the --no-verify option to skip it.

git commit --no-verify
git push --no-verify



Tip

For details on the make commands, refer to the Makefile

🚀 Run Server on Local

make run

💯 Test

make test

✅ Lint & Format

Check lint & format only

make check

Format

make format



👤 Authors

  • Maintainer: @devbruce