Initial FastAPI project with SQLAlchemy (asyncpg), Alembic, Pydantic v2, Pytest, Poetry, Gunicorn, Docker, docker-compose, ruff, black, isort, flake8, coverage, factory-boy, pytest-alembic, pydantic-factories.
- Python 3.12 (Main programming language for Back-end)
- Poetry (For package and dependencies management)
- Docker & docker-compose (For containerization of app)
- Taskfile (Commands runner)
cp example.env .env
poetry env use python3.11
poetry shell
poetry install
docker-compose up -d
It also possible to uncomment backend service inside docker-compose.yml and run through the docker compose.
Note: Set
POSTGRES_HOST
topostgres
(POSTGRES_HOST=postgres
) inside .env file
poetry run python -m apps
task run
- poetry (with pyproject.toml)
- Docker
- docker-compose
- db (PostgreSQL latest)
- pgadmin (PGAdmin — GUI for PostgreSQL simplifies query creation, profiling and management, debugging)
- redis (Redis latest)
- redis_insights (Redis Insights — GUI for Redis)
- backend (Commented — possible to run Back-end via docker-compose)
- pytest (with pytest-asyncio)
- pytest-cov (for run tests with coverage)
- pytest-mock (to use
mocker
fixture) - pytest-randomly (to random sort tests in runtime)
- pytest-clarity (for better tests fails descriptions)
- Faker (to generate random data)
- pytest-alembic (to run tests on migrations)
- factory-boy (to generate model factories in db)
- iPython (enhanced console for Python)
- ruff (Rust based linter & formatter)
- xenon (code linter, complexity linter)
- mypy (code linter, type annotations linter)
- FastAPI (Starlette) (ASGI web framework)
- typer (CLI creation framework)
- SQLAlchemy (ORM, Core, db schema declaration)
- alembic (DB migrations tool)
- psycopg2-binary (sync driver for working with PostgreSQL)
- asyncpg (async driver for working with PostgreSQL)
- aioredis (async driver for working with Redis)
- httpx (async client library)
- orjson (fast JSON serialization/deserialization)
- pydantic v2 (JSON & data validation tool)
- uvicorn (ASGI web server implementation)
- gunicorn (process management tool)
- bcrypt (hashing library, passwords hashing)
- PyJWT (library for working with JWT tokens)