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.eventsinstead of directly frompyventusor its submodules. - The inheritance structure of the
EventEmitterhas been replaced with composition using theProcessingService. Custom event emitters must now be implemented through theProcessingServiceinterface and composed with theEventEmitterclass. - The
EventLinkerhas 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 asetinstead of alist. -
get_events_by_event_handler()→get_events_from_subscribers(): Now returns asetinstead of alistand supports retrieving events for multiple subscribers. -
get_event_handlers_by_events()→get_subscribers_from_events(): Now returns asetinstead of alistand includes a new flagpop_onetime_subscribers. -
unsubscribe()→remove(): Now removes one event from a subscriber at a time. - Parameters named
event_handlerhave been renamed tosubscriberin all methods. -
get_events(): Now returns asetinstead of alistwith non-duplicates.
-
- The
RQEventEmitterhas been renamed toRedisEventEmitter. - The
CeleryEventEmitter.Queuehas been removed, and theCeleryEventEmitternow requires aCeleryinstance. Security aspects have been delegated to theCeleryapp. - Dependency injection for the
FastAPIEventEmitterthrough FastAPI'sDepends()function has been simplified; useDepends(FastAPIEventEmitter())for all scenarios. - The
ExecutorEventEmittercan 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.