Metadata-Version: 2.5
Name: drfast-api
Version: 0.2.0
Summary: DRF-inspired async APIs for FastAPI and Tortoise ORM
Project-URL: Documentation, https://drfast-api.readthedocs.io/en/latest/index.html
Project-URL: Issues, https://github.com/Nomadicode/drfast-api/issues
Project-URL: Source, https://github.com/Nomadicode/drfast-api
Author: DRFast API contributors
License: MIT
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: AsyncIO
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: email-validator<3,>=2.2
Requires-Dist: fastapi-users<16,>=15.0.5
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: pydantic-settings<3,>=2.3
Requires-Dist: pydantic<3,>=2.7
Requires-Dist: tortoise-orm<2,>=1
Requires-Dist: uvicorn[standard]<1,>=0.30
Provides-Extra: docs
Requires-Dist: sphinx<9,>=8; extra == 'docs'
Provides-Extra: encryption
Requires-Dist: cryptography>=43; extra == 'encryption'
Provides-Extra: files
Requires-Dist: boto3<2,>=1.35; extra == 'files'
Requires-Dist: pillow>=11; extra == 'files'
Provides-Extra: images
Requires-Dist: pillow>=11; extra == 'images'
Provides-Extra: postgres
Requires-Dist: asyncpg<1,>=0.29; extra == 'postgres'
Provides-Extra: s3
Requires-Dist: boto3<2,>=1.35; extra == 's3'
Description-Content-Type: text/markdown

# DRFast API

DRFast API brings familiar Django REST Framework patterns to fully async FastAPI applications backed by Tortoise ORM.

It is pre-1.0 software. The public surface includes serializers, model viewsets, routers, permissions, middleware, settings, Tortoise lifecycle integration, FastAPI Users integration, and the `drfast` management CLI.

## Quick start

```bash
uv add drfast-api
drfast startproject config
cd config
uv sync
drfast migrate
drfast runserver
```

Generated projects use SQLite locally. Set `DATABASE_URL` to a PostgreSQL URL and install `drfast-api[postgres]` for production.

## Application structure

Projects explicitly list Tortoise model modules in `Settings.installed_apps`. A generated app keeps models, serializers, and views separate:

```python
class TodoSerializer(ModelSerializer[Todo]):
	model = Todo
	id = UUIDField(read_only=True)
	title = CharField()


class TodoViewSet(ModelViewSet):
	model = Todo
	serializer_class = TodoSerializer
	ordering_fields = ("created_at", "title")
```

Register it with `DefaultRouter`, then include the router in the FastAPI application. Viewset handlers, serializer hooks, permission methods, and middleware hooks are asynchronous.

`drfast` delegates migration operations to Tortoise’s current built-in migration CLI:

```bash
drfast init
drfast makemigrations --name add_todos
drfast migrate
drfast history
```

The starter’s authentication uses FastAPI Users with DRFast’s Tortoise adapter. It enables registration and bearer JWT login; password reset and email verification require application-provided delivery hooks before they are enabled.

## Configuration

Copy `.env.example` to `.env` in generated projects. `SECRET_KEY` must be changed and `DEBUG=false` set for production. SQLite is suitable for local development and isolated tests; production should use PostgreSQL, explicit migrations, and an `asyncpg` connection URL.

## Development

```bash
uv sync
uv run ruff check .
uv run mypy src
uv run pytest
uv run bandit -q -r src
uv run pip-audit --skip-editable
uv run python -m build
```

The CI workflow also runs Bandit and pip-audit. Configure the PyPI trusted publisher for the `pypi` GitHub environment before tagging a release.

## Documentation

The full user guide and API reference live in [`docs/`](docs/index.rst) and are
published by Read the Docs using [`.readthedocs.yaml`](.readthedocs.yaml).
Build them locally with the documentation extra:

```bash
uv sync --extra docs
uv run sphinx-build -W -b html docs docs/_build/html
```

The warnings-as-errors flag matches the hosted build, so broken references and
invalid reStructuredText fail locally too.

