Skip to content

Installation

Requirements

Dependency Version
Python >= 3.9
FastAPI >= 0.110
Pydantic >= 2.5, < 3
SQLAlchemy >= 1.4.36
python-dotenv >= 0.19

Install from PyPI

pip install fastapi-viewsets

Optional extras

SQLAlchemy is a core dependency (installed automatically). The extras below add ORM-specific packages when you need Tortoise or Peewee:

pip install "fastapi-viewsets[sqlalchemy]"

For async SQLAlchemy, also install a driver:

pip install aiosqlite          # SQLite (development)
pip install asyncpg            # PostgreSQL
pip install aiomysql            # MySQL
pip install "fastapi-viewsets[tortoise]"   # pulls in asyncpg

For MySQL with Tortoise:

pip install "fastapi-viewsets[tortoise]" aiomysql
pip install "fastapi-viewsets[peewee]"

# PostgreSQL driver
pip install psycopg2-binary

# MySQL driver
pip install pymysql
pip install "fastapi-viewsets[test]"

Includes pytest, pytest-asyncio, pytest-cov, httpx, faker, and aiosqlite.

Install from source (development)

git clone https://github.com/svalench/fastapi_viewsets.git
cd fastapi_viewsets
pip install -e ".[test,lint]"

Verifying the installation

python -c "from fastapi_viewsets import BaseViewset, AsyncBaseViewset; print('OK')"

If this prints OK, you're ready to go.

What's next