Upgrade Guide¶
Welcome to the Upgrade Guide for Pyventus v0.7
! In this section, you will learn how to properly upgrade your application from Pyventus v0.6
to v0.7
, as well as address any potential issues related to breaking changes, ensuring a smooth transition to the latest version.
Upgrading to the Latest Version¶
Pyventus is published as a Python package and can be easily upgraded with pip
. To get started, open up a terminal and upgrade Pyventus with the following command:
Reviewing Key Breaking Changes¶
Please review the following breaking changes and apply the necessary actions to effectively update your application. You can mark each item as complete to track your progress.
- All previous event-driven features must now be imported from the new inner package
pyventus.events
instead of directly frompyventus
or its submodules. - The inheritance structure of the
EventEmitter
has been replaced with composition using theProcessingService
. Custom event emitters must now be implemented through theProcessingService
interface and composed with theEventEmitter
class. - The
EventLinker
has experienced some method renames and return type modifications to align with the new redesigned codebase:-
remove_event_handler()
→remove_subscriber()
. -
get_event_handlers()
→get_subscribers()
: Now returns aset
instead of alist
. -
get_events_by_event_handler()
→get_events_from_subscribers()
: Now returns aset
instead of alist
and supports retrieving events for multiple subscribers. -
get_event_handlers_by_events()
→get_subscribers_from_events()
: Now returns aset
instead of alist
and includes a new flagpop_onetime_subscribers
. -
unsubscribe()
→remove()
: Now removes one event from a subscriber at a time. - Parameters named
event_handler
have been renamed tosubscriber
in all methods. -
get_events()
: Now returns aset
instead of alist
with non-duplicates.
-
- The
RQEventEmitter
has been renamed toRedisEventEmitter
. - The
CeleryEventEmitter.Queue
has been removed, and theCeleryEventEmitter
now requires aCelery
instance. Security aspects have been delegated to theCelery
app. - Dependency injection for the
FastAPIEventEmitter
through FastAPI'sDepends()
function has been simplified; useDepends(FastAPIEventEmitter())
for all scenarios. - The
ExecutorEventEmitter
can no longer be used as a context manager; for this purpose, use the newExecutorEventEmitterCtx
.
Questions and Issues¶
If you have any questions or run into issues during the upgrade process, please feel free to open a new issue or start a discussion. Before doing so, it is recommended to check for existing inquiries to avoid duplicates.