FastAPI Class Views and utilities
Project description
fastapi-views
FastAPI Class Views and utilities
Version: 0.0.1
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
Release history Release notifications | RSS feed
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.1.tar.gz
(15.0 kB
view details)
Built Distribution
File details
Details for the file fastapi_views-0.0.1.tar.gz
.
File metadata
- Download URL: fastapi_views-0.0.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad78807d0037c2e5ab02e5f85082693c68ef44cd0d3dbce94cf04e9f9b19080 |
|
MD5 | 55844c2e73a755a1e6ddaa9752706b33 |
|
BLAKE2b-256 | 6412fccf681dc2f01f04ce5a13d479616804fa48ac6b6f36e8c21d4bc26203d8 |
File details
Details for the file fastapi_views-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_views-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1101d91052a03cf7ceff22eedfc3569fb2f0043a440d5dee929de72f9076141 |
|
MD5 | cbe6a925750bc5e5d2ef726ed1cd1a95 |
|
BLAKE2b-256 | 5957a9846c7384535cc83ba602528a1059c0dd2c4f9e5cab5b8a12d9f3eee049 |