High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (powered by Redis & PostgreSQL).
git clone https://github.com/leosussan/fastapi-gino-arq-uvicorn.git
Python 3.8
and poetry
.
asdf
- a universal version manager (think nvm
or pyenv
)
asdf
.asdf plugin add python
asdf plugin add poetry
asdf install
-- will download & configure this project's Python
+ poetry
setupasdf install python 3.8.2 && asdf global python 3.8.2
Python 3.8
and poetry
installed already, please feel free to skip.poetry install
).poetry shell
, run pre-commit install
)..dist.env
, rename to .env
. Fill in PostgreSQL, Redis, Sentry (optional) variables.poetry shell
, run alembic revision --autogenerate
.
alembic upgrade head
.NOTE: You must have PostgreSQL & Redis running locally.
poetry run task app
python app/main.py
.poetry run task worker
Docker
is running locally.poetry run task compose-up
*.
poetry run task compose-down
to spin down, clean up.*app/settings/prestart.sh
will run migrations for you before the app starts.
/app/routes
, import & add them to the ROUTERS
constant in /app/main.py
/app/models/orm
, add them to /app/models/orm/migrations/env.py
for migrations/app/models/pydantic
/app/models/orm/queries
app/tasks
./.env
, expose & import them from /app/settings/globals.py
ARQ_BACKGROUND_FUNCTIONS
env.SENTRY_DSN
in your environment to enable Sentry./app/settings/prestart.sh
black
+ isort
) and linting (flake8
).