Skip to main content

FastAPI Class Views and utilities

Project description

fastapi-views

CI Build License Python Format PyPi Mypy Code Style security: bandit

FastAPI Class Views and utilities


Version: 0.0.2

Documentation: https://performancemedia.github.io/fastapi-views/

Repository: https://github.com/performancemedia/fastapi-views


Installation

pip install fastapi-views

Usage

from typing import Optional
from uuid import UUID

from fastapi_views import Serializer
from fastapi_views.views.api import L
from fastapi_views.views.viewsets import APIViewSet


class ItemSchema(Serializer):
    id: UUID
    name: str
    price: int


items = {}


class MyView(APIViewSet):
    serializer = ItemSchema

    async def list(self, *args, **kwargs) -> L:
        return list(items.values())

    async def create(self, item: ItemSchema) -> ItemSchema:
        items[item.id] = item
        return item

    async def retrieve(self, id: UUID) -> Optional[ItemSchema]:
        return items.get(id)

    async def update(self, item: ItemSchema):
        items[item.id] = item

    async def destroy(self, id: UUID) -> None:
        items.pop(id, None)

Features

  • Class Based Views
    • APIViews
    • GenericViews
    • ViewSets
  • Openapi id simplification
  • 'Smart' and fast serialization using orjson
  • Http Problem Details implementation
  • Automatic prometheus metrics exporter
  • Pluggable healthcheck helper

Project details


Download files

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

Source Distribution

fastapi_views-0.0.2.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

fastapi_views-0.0.2-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_views-0.0.2.tar.gz.

File metadata

  • Download URL: fastapi_views-0.0.2.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for fastapi_views-0.0.2.tar.gz
Algorithm Hash digest
SHA256 34015de5fc0dd9c23d25b86e08fa27fa553b492d2aeee32bb97c8be71696e85f
MD5 1e6d81fc1253eacf4ca444e7905821f2
BLAKE2b-256 c64035af7e8669de5c2f8613bcb08bc2dae8e6b4d21cf61c48e047a188f684f6

See more details on using hashes here.

File details

Details for the file fastapi_views-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_views-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efd01f470228637188590fcd9402c8936ffcd49195fe652d42b9c1e4b414da9a
MD5 381dfad969943d99dd438a5f9b553efa
BLAKE2b-256 72509bb766f81c75ff33e115415a1510d48969fd2e06b21fdf0d0f33dacda895

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page