Registry / web-framework / fastapi-cloudevents

fastapi-cloudevents

JSON →
library2.0.2pypypiunverified

A FastAPI plugin for integrating CloudEvents. Current version 2.0.2, release cadence: sporadic.

pip install fastapi-cloudevents
INSTALL
IMPORT
SIG · FASTAPI-CLOUDEVENT
F
fastapi-cloudevents
web-frameworkpythonv2.0.2
Install
4.2s avg
Import
50ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 35.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.2s · import 0.010s · 35MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CloudEvent
from fastapi_cloudevents import CloudEvent
from cloudevents.http import CloudEvent

Basic example of receiving and sending CloudEvents with FastAPI.

from fastapi import FastAPI, Request from fastapi_cloudevents import from_event, to_event from cloudevents.http import CloudEvent app = FastAPI() @app.post("/") async def receive(request: Request): event = from_event(request) print(event) return to_event(CloudEvent({"type": "example", "source": "test"}, {"message": "Hello"}))
Debug
Known issues
breakingVersion 2.0.0 introduced Pydantic V2 support, dropping V1. If your project uses Pydantic V1, stay on v1.x or migrate models.
fix
Use Pydantic V2 or pin fastapi-cloudevents<2.0.0.
affects: >=2.0.0
deprecatedUse of `from_event` on raw dicts is deprecated; always pass a FastAPI Request object.
fix
Pass the `Request` object from FastAPI endpoint, not a dict.
affects: >=2.0.0
gotchaThe `to_event` function returns a Starlette Response, not a CloudEvent object. Do not try to call `.data` on it.
fix
Return the response directly from your endpoint, or inspect the body via `response.body`.
affects: all
Upgrade
Version history
2.0.2latest on PyPI · released Feb 24, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
40
OpenAI (training)
2
Resources
fastapi-cloudevents — pip install fastapi-cloudevents · libregistry