Fastapi-events

Latest version: v0.12.2

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

0.6.0

What's Changed
* feat: add support for google-cloud-pubsub closes 25 by Mohsin-Ul-Islam in https://github.com/melvinkcx/fastapi-events/pull/30

New Contributors
* Mohsin-Ul-Islam made their first contribution in https://github.com/melvinkcx/fastapi-events/pull/30

**Full Changelog**: https://github.com/melvinkcx/fastapi-events/compare/v0.5.1...v0.6.0

0.5.1

What's Changed
* fixed a bug with custom middleware_id by smithk86 in https://github.com/melvinkcx/fastapi-events/pull/33


**Full Changelog**: https://github.com/melvinkcx/fastapi-events/compare/v0.5.0...v0.5.1

0.5.0

What's Changed
* Typing/mypy improvements by smithk86 in https://github.com/melvinkcx/fastapi-events/pull/29
* add optional middleware_id (dispatching events on startup in now possible) by smithk86 in https://github.com/melvinkcx/fastapi-events/pull/28

New Contributors
* smithk86 made their first contribution in https://github.com/melvinkcx/fastapi-events/pull/29

**Full Changelog**: https://github.com/melvinkcx/fastapi-events/compare/v0.4.0...v0.5.0

0.4.0

What's Changed?

Event Chaining: Dispatching Events Within Handlers

Previously, `dispatch()` can only be called within a request-response cycle.

With v0.4.0, it is now possible to invoke `dispatch()` within event handlers. A huge thanks to ndopj for contributing his idea in 23.

Please refer to [this section](https://github.com/melvinkcx/fastapi-events#3-dispatching-events-within-handlers-event-chaining) for more details.

0.3.0

What's Changed

Event payload validation via Pydantic

Full documentation can be found [here](https://github.com/melvinkcx/fastapi-events#event-payload-validation-with-pydantic)

python
import uuid
from enum import Enum
from datetime import datetime

from pydantic import BaseModel
from fastapi_events.registry.payload_schema import registry as payload_schema


class UserEvents(Enum):
SIGNED_UP = "USER_SIGNED_UP"
ACTIVATED = "USER_ACTIVATED"


Registering your event payload schema
payload_schema.register(event_name=UserEvents.SIGNED_UP)
class SignUpPayload(BaseModel):
user_id: uuid.UUID
created_at: datetime



python
Events with payload schema registered
dispatch(UserEvents.SIGNED_UP) raises ValidationError, missing payload
dispatch(UserEvents.SIGNED_UP,
{"user_id": "9e79cdbb-b216-40f7-9a05-20d223dee89a"}) raises ValidationError, missing `created_at`
dispatch(UserEvents.SIGNED_UP,
{"user_id": "9e79cdbb-b216-40f7-9a05-20d223dee89a", created_at: datetime.utcnow()}) OK!

Events without payload schema -> No validation will be performed
dispatch(UserEvents.ACTIVATED,
{"user_id": "9e79cdbb-b216-40f7-9a05-20d223dee89a"}) OK! no validation will be performed

0.2.2

What's Changed
* `local_handler.register()` can now be chained: (19, fixes 17)


local_handler.register(event_name="foo")
local_handler.register(event_name="bar")
async def handle_foo_bar(event: Event):
pass

Page 3 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.