Skip to main content

DynamicForms FastAPI Viewsets

Django REST Framework-style viewsets for FastAPI, with optional Celery-backed async execution and a matching Vue/TypeScript client counterpart.

  • Python mixins for FastAPI — compose CRUD and bulk endpoints from small, focused mixin classes.
  • route_viewset decorator — register a viewset on a FastAPI router with a single decorator call. Handles type resolution, lifecycle management and OpenAPI schema automatically.
  • CollectionViewSet — zero-boilerplate in-memory viewset backed by any Python list, set or dict. Great for prototyping and testing.
  • celery_viewset decorator — move a viewset's execution to a Celery worker with no code changes to the viewset itself, for long-running or background processing scenarios (requires the celery extra).
  • Bulk operations — first-class support for bulk create, update, partial update and destroy.
  • Vue / TypeScript counterpart — mirror mixin classes and a route_rest factory give you a fully typed HTTP client that matches your backend viewset exactly (published separately as @dynamicforms/fastapi-viewsets on npm).

Installation

pip install dynamicforms-fastapi-viewsets

# with Celery-backed viewset support
pip install "dynamicforms-fastapi-viewsets[celery]"

Requires Python 3.10+, FastAPI and Pydantic v2.

Quick example

from fastapi import APIRouter, FastAPI
from pydantic import BaseModel

from fastapi_viewsets.collection_viewset import CollectionViewSet
from fastapi_viewsets.decorators.route_viewset import route_viewset
from fastapi_viewsets.mixins import BulkViewSetMixin


class Item(BaseModel):
    id: int
    name: str


database: dict[int, Item] = {1: Item(id=1, name="First element")}

app = FastAPI()
router = APIRouter()


@route_viewset(router, base_path="/items", pk_field_name="id")
class ItemViewSet(CollectionViewSet[int, Item], BulkViewSetMixin[int, Item]):
    def __init__(self):
        super().__init__(container=database, pk_field="id")


app.include_router(router)

See the full documentation for guides on the mixin system, route_viewset, CollectionViewSet, celery_viewset, and the Vue client.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamicforms_fastapi_viewsets-0.3.6.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamicforms_fastapi_viewsets-0.3.6-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

Details for the file dynamicforms_fastapi_viewsets-0.3.6.tar.gz.

File metadata

File hashes

Hashes for dynamicforms_fastapi_viewsets-0.3.6.tar.gz
Algorithm Hash digest
SHA256 03158c0d0a4faefba3bd3322569c3e05d6861050c0d05002dabc51ca36a0f25c
MD5 d6ff0e685e3b41155c2ba60b046e0574
BLAKE2b-256 77d4cc19042372d7a867a6d4ce59d8d39628b4c595d8898c85be4889d144dee1

See more details on using hashes here.

File details

Details for the file dynamicforms_fastapi_viewsets-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamicforms_fastapi_viewsets-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7420175b4af5b148ec5793f3d4487c17e24b25a5c0a2691ce45a853bc4f53f0a
MD5 53441f1686d9e4b5ce78981f7c3b986a
BLAKE2b-256 b080646fbfc29f91aa2478f6a6b2f3719a8f76d8eecaf17234530c2caf8f6495

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.4

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.7

2 files

0.5.6

2 files

0.5.5

2 files

0.5.4

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.6 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page