Releases: mdapena/pyventus
v0.8.0
Release Note
Added
-
Added a new optional constructor parameter to the
AsyncIOProcessingServicecalledenforce_submission_order. WhenTrue, submissions are processed in the same order as they were received, including nested/inner submissions and across threads. Default:False. -
Added a new optional constructor parameter to the
AsyncIOProcessingServicecalledforce_async. WhenTrue, synchronous callbacks submitted to the processing service will be forced to run asynchronously through theasyncio.to_thread()function. Default:False. -
Added a new property to the
AsyncIOProcessingServicecalledtask_name, which returns the name used for all tasks created by a processing service instance. -
Added a new property to the
AsyncIOProcessingServicecalledtask_count, which returns the number of tasks that are currently active within anAsyncIOProcessingServiceinstance. -
Added a new class method to the
AsyncIOProcessingServicecalledall_tasks(), which returns all currently active tasks across all instances. -
Added a new class method to the
AsyncIOProcessingServicecalledguard(), which is a decorator forasynccallables that ensures all active tasks across all instances in the current event loop are completed before the decorated coroutine continues. -
Added a new
Observablesubclass calledObservableValue, a value-centric observable that focuses on a single value and its changes over time. -
Added a new
Observablesubclass calledObservableStream, a data flow-centric observable that focuses exclusively on the stream of its entries over time.
Changed
-
Updated internal methods of the
AsyncIOProcessingServicefor standardized naming. -
Updated the
wait_for_tasks()method of theAsyncIOProcessingServiceto wait for all tasks in the current asyncio loop, including new and nested tasks. Previously, only active tasks were awaited. -
Updated the
submit()method of theAsyncIOProcessingServiceto handle task submissions based on theenforce_submission_orderandforce_asyncconfigurations. -
Updated the
_emit_next()method of theObservablebase class to incorporate a new optional parameter calledsubscribers, which corresponds to the collection of subscribers to be used for the notification. -
Updated the
_emit_error()method of theObservablebase class to incorporate a new optional parameter calledsubscribers, which corresponds to the collection of subscribers to be used for the notification. -
Updated the
_emit_complete()method of theObservablebase class to incorporate a new optional parameter calledsubscribers, which corresponds to the collection of subscribers to be used for the notification.
Changelog
- Full Changelog: 0.7.2...0.8.0
- Contributors: @mdapena
v0.7.2
Release Note
Changed
-
Added support for Python
3.14, ensuring compatibility with the latest features and improvements. -
Bumped the
upload-artifactaction tov5in thepublish-to-pypi.ymlworkflow. -
Bumped the
download-artifactaction tov6in thepublish-to-pypi.ymlworkflow. -
Bumped the
setup-pythonaction tov6in thedeploy-docs.yml,publish-to-pypi.yml, andrun-tests.ymlworkflows. -
Bumped the
checkoutaction tov5in thedeploy-docs.yml,publish-to-pypi.yml, andrun-tests.ymlworkflows.
Changelog
- Full Changelog: 0.7.1...0.7.2
- Contributors: @mdapena
v0.7.1
Release Note
Changed
-
Refactored the
StdOutLoggerto improve usability, configuration, and standardization of logging messages. -
Enabled a
config()method in theStdOutLoggerfor straightforward configuration of the Pyventus logger. -
Introduced a
critical()method in both theStdOutLoggerandLoggerclasses for logging critical-level messages. -
Updated the
error()method in both theStdOutLoggerandLoggerclasses to include theexc_infoparameter, allowing exception information to be logged for better insights during debugging. -
Enhanced the
execute()method of the Event Handler to include exception information in error logs, improving debugging when errors occur. -
Improved error logging in the
Observableclass by including exception information in error logs for better debugging when errors occur.
Changelog
- Full Changelog: 0.7.0...0.7.1
- Contributors: @mdapena
v0.7.0
Release Note
Breaking Changes
-
The
typing-extensionspackage is now a required dependency for Pyventus. This dependency has been added to support advanced typing features in older versions of Python. -
All previous event-driven features must now be imported from the inner package
pyventus.eventsinstead of directly frompyventus. These changes were necessary due to the integration of the reactive programming paradigm. This series of refactors were implemented not only to ensure an organized codebase but also to establish a clear boundary between event handling and reactive programming features, enabling optimized imports based on the required paradigm. -
The inheritance structure of the
EventEmitterhas been replaced with composition using the newProcessingServiceinterface. This interface establishes a common ground for processing calls, such as event emissions, in a decoupled and flexible manner. TheEventEmitteris now a concrete class that requires aProcessingServiceinstance, referred to asevent_processor, for initialization. These changes not only preserve the overall behavior and workflow of theEventEmitterbut also enhance its modularity and flexibility. -
The
EventLinkerclass has experienced multiple method renames and return type modifications to align with the new redesigned codebase, enhancing the API for improved usability and intuitiveness. Below is a detailed list of the breaking changes made to theEventLinkerclass:- The inner class
EventLinkageWrapperwas renamed toEventLinkerSubCtxfor consistency with the new concept of a subscription context and now extends from the base classSubscriptionContext. The overall workflow remains roughly the same but was reworked to align with its base class and introduce optimizations based on user needs. - The method
get_events()now returns asetof all registered events instead of alistwith non-duplicated events. - The method
get_event_handlers()was renamed toget_subscribers()for consistency, and it now returns asetof all registered subscribers instead of alistwith non-duplicated subscribers. - The method
get_events_by_event_handler()was renamed toget_events_from_subscribers()for consistency. It now returns asetof events associated with the specified subscribers instead of alistof non-duplicated events associated with the specified subscribers. This method now also supports retrieving events from multiple subscribers instead of only one at a time. - The method
get_event_handlers_by_events()was renamed toget_subscribers_from_events()for consistency. It now returns asetof subscribers associated with the specified events instead of alistof non-duplicated subscribers associated with the provided events. Additionally, a new flag calledpop_onetime_subscriberswas added to remove and return those subscribers that are one-time subscriptions. - The method
unsubscribe()was renamed toremove()for consistency with the new concept of subscription and the encapsulation of the unsubscription process through theteardown_callback. This method now allows you to remove one event and subscriber from the registry at a time instead of multiple events of the given subscriber. - The method
remove_event_handler()was renamed toremove_subscriber()for consistency. - Parameters named
event_handlerwere renamed tosubscriberfor consistency.
- The inner class
-
The
EventHandlerhas been refactored from a class to an interface, outlining the overall workflow and essential protocols for event handling. However, the previous implementation of theEventHandlerhas been transitioned to one of its concrete classes namedEventSubscriber. This newEventSubscriberclass not only implements theEventHandlerinterface but also combines it with theSubscriptionbase class, providing a convenient way to both handle event responses and manage the subscription lifecycle.
Added
-
Added a reactive programming module to expand Python's event-driven capabilities for data-oriented processes and the ability to react efficiently to state changes over time.
- Added the
Observablebase class, which defines a lazy push-style notification mechanism for streaming data to subscribers. - Added the
ObservableTaskclass, an observable subclass that encapsulates a unit of work and offers a mechanism for streaming its results reactively. - Added the
as_observable_task()decorator to easily convert any given callable into an observable task. - Added the
Observerinterface, which defines the overall workflow and essential protocols for responding to notifications from an observable. - Added the
Subscriberclass, which combines theObserverinterface with theSubscriptionbase class to provide a convenient way to respond to state changes emitted by an observable and manage the subscription lifecycle.
- Added the
-
Added the
Unsubscribableinterface, which provides a standardized method for objects to unsubscribe from a source and release any associated resources. -
Added the
Subscriptionbase class to simplify subscription management and resource cleanup with ateardown_callbackthat is called during unsubscription. -
Added the
SubscriptionContextbase class, which defines the overall workflow for subscription contexts, allowing the user to define step-by-step the object that will later be subscribed to the specified source. -
Added a new package global exception called
PyventusImportException, which is a custom Pyventus exception for handling missing imports within the library. -
Added the
MultiBidictdata structure, a generic multikeyed, multivalued bidirectional dictionary that offers a flexible mapping structure for efficient lookups, updates, and deletions of keys and their corresponding values. -
Introduced the
ProcessingServiceinterface to define flexible execution strategies for various use cases. This release includes the following concrete implementations:AsyncIOProcessingService: A processing service that utilizes theAsyncIOframework to handle the execution of calls.CeleryProcessingService: A processing service that utilizes theCeleryframework to handle the execution of calls.ExecutorProcessingService: A processing service that utilizes the Python'sExecutorto handle the execution of calls.FastAPIProcessingService: A processing service that uses FastAPI'sBackgroundTasksto handle the execution of calls.RedisProcessingService: A processing service that utilizes theRedis Queueframework to handle the execution of calls.
-
Added the
CallableWrapperclass to encapsulate callables and provide a unified asynchronous interface for their execution. -
Added new features to the
EventLinkerclass, including the following methods:- Introduced the
get_valid_subscriber()method for a centralized mechanism to validate event subscribers. - Added the
is_empty()method to efficiently check if the main registry is empty. - Added the
get_event_count()method to return the total number of events in the registry. - Added the
get_subscriber_count()method to return the total number of subscribers in the registry. - Added the
get_event_count_from_subscriber()method to return the number of events for a specific subscriber. - Added the
get_subscriber_count_from_event()method to return the number of subscribers for a specific event. - Added the
contains_event()method to check if a specific event is present in the registry. - Added the
contains_subscriber()method to check if a specific subscriber is present in the registry. - Added the
are_linked()method to determine if a specific event is linked to a given subscriber. - Introduced the
stateful_subctxparameter in theonce()andon()methods to configure theEventLinkerSubCtxbehavior and optimize the subscription context based on user needs.
- Introduced the
-
Introduced the
EventSubscriberclass, which combines event handling capabilities with subscription lifecycle management. -
A new
benchmarkspackage has been added to thetestsdirectory for performance evaluation of Pyventus. This release introduces theEventEmitterBenchmark, which measures the efficiency of theEventEmitterin handling event emissions. -
Added a set of utilities for creating preconfigured event emitter instances, making the setup process easier. These utilities also provide retro compatibility with the previous class-based design.
Changed
-
Enhanced the
emit()method in theEventEmitterto support the emission of global events (...). -
Moved callback utilities to a dedicated module within
pyventus.corefor improved organization and reusability. -
Standardized the structure of Python classes and their representation, including the use of the
@override()decorator for consistency andmypystatic type checking. -
Standardized the structure of the
pyproject.tomlfile. -
Enhanced Pyventus logs by adding process and thread IDs for better debugging.
-
Switched from the
Blackformatter toRufffor improved development efficiency and enhanced code quality. -
Refactored all project docstrings to follow a standardized format, enhancing consistency and clarity in the documentation.
-
Upgraded several development dependencies in the
pyproject.toml, includingpytest-asynciofrom version0.21.0to0.24.0, to enable global configuration of theasyncio_mode. -
Simplified the
EventCallbackTypetype alias by removing the unnecessaryParamSpec. -
Refactored the test suite to improve validation across all package features, ensuring correctness and ac...
v0.6.0
Release Note
Added
- Added support for Python
3.13, ensuring compatibility with the latest features and improvements. - Added
mikepackage integration tomkdocs-materialfor documentation versioning. This allows users to access previous documentation alongside new changes, ensuring that legacy content remains intact for reference. Additionally, a newdevdocumentation has been introduced to showcase the current development of the package, including unreleased features and updates.
Changed
- Updated documentation links from absolute to relative paths to prevent broken links and avoid redirecting users to incorrect documentation versions, ensuring consistent navigation throughout the docs.
- Upgraded the
download-artifactandcacheactions tov4in thepublish-to-pypi.ymlworkflow. - Updated the
deploy-docs.ymlworkflow to deploy bothdevand versioned documentation usingmike's CLI commands.
Fixed
- Fixed broken links to non-versioned documentation by adding a custom
404.htmlpage togh-pages, which redirects users to the first version of the documentation when no version is specified, or to a new custom 404 page with helpful suggestions.
Changelog
- Full Changelog: 0.5.0...0.6.0
- Contributors: @mdapena
v0.5.0
Release Note
Breaking Changes
- Removed the base
Eventclass due to improved event semantics and unnecessary redundancy. - Renamed the
get_event_registry()method ofEventLinkertoget_registry(). - Renamed the
__event_registryinner property ofEventLinkerto__registry. - Renamed the
get_events_by_handler()method ofEventLinkertoget_events_by_event_handler(). - Renamed the
get_handlers_by_events()method ofEventLinkertoget_event_handlers_by_events(). - Renamed the protected method
_executor_callback()of theExecutorEventEmitterto_callback(). - Renamed the task name of
CeleryEventEmitterfrom_executortopyventus_executorto avoid collisions with other task names.
Added
- Added
__slots__toEventLinkageWrapperclass for more efficient memory usage. - Extended support for subscription and emission of any
dataclassobject, removing the limitation of onlyEventsubclasses. - Added the
force_asyncparameter to theEventHandlerclass andEventLinkersubscription methods to be able to optimize the execution ofsynccallbacks based on their workload. - Introduced a new event semantic where the Python
...(Ellipsis) is now used to refer to all events on a subscription, like theonAny()method but with a Pythonic syntax. - Added the
mkdocs-material social cardsplugin, which provides a preview of the documentation content when shared on social media platforms.
Changed
- Standardized the order of static methods, class methods, and instance methods for improved readability.
- Applied Python best practices to optimize the methods within the
EventLinkerandEventEmitterclasses. - Improved validation of variable instances in the event emitters,
EventLinker, andEventHandler. - Updated and improved the test suite to ensure accurate validation and consistency.
- Enabled creation date for the mkdocs
git-revision-date-localizedplugin. - Replaced the mkdocs
git-authorsplugin with thegit-committersplugin. - Updated and improved the package description.
- Updated the tutorial section to incorporate recent changes.
- Enhanced the documentation index page and README file with new examples and better descriptions to showcase the unique features of Pyventus.
Removed
- Removed the default value of the
onceflag in theEventHandlerclass.
Fixed
- Fixed and standardized all package docstrings and code comments for consistency and clarity.
- Addressed minor errors and details in the documentation.
Changelog
- Full Changelog: 0.4.1...0.5.0
- Contributors: @mdapena
v0.4.1
Release Note
Changed
- Optimized the size of the source distribution (sdist) build by including only essential files and directories, such
as the/srcand/testsdirectories, as well as the following files:.gitignore,pyproject.toml,
CITATION.cff,README, andLICENSE. - Refactored documentation dependencies into an optional dependency called
docs. - Updated the
deploy-docs.ymlGitHub workflow to leverage the new optional dependencydocs. - Updated the
EventEmissionclass with the@finaldecorator from the typing module, indicating that it is meant for
internal use only and should not be subclassed.
Fixed
- Addressed minor errors and details in the documentation.
Changelog
- Full Changelog: 0.4.0...0.4.1
- Contributors: @mdapena
v0.4.0
Release Note
Added
- Added
FastAPIEventEmitterimplementation to facilitate seamless integration with theFastAPIframework. - Added tests for
FastAPIEventEmitterto validate its behavior and ensure proper operation. - Added documentation for
FastAPIEventEmitter, including tutorials and API references. - Integrated the
Coveralls.ioworkflow to generate coverage badge and reports. - Included coverage badges on the main documentation page and the readme file.
- Introduced permalinks within the documentation for easy navigation.
Changed
- Updated
pyproject.tomlwith the new optional dependency forFastAPIintegration.
Fixed
- Addressed minor errors in the Pyventus documentation to improve accuracy and clarity.
Changelog
- Full Changelog: 0.3.0...0.4.0
- Contributors: @mdapena
v0.3.0
Release Note
Breaking Changes
- Introduced
EventEmissionobject to encapsulate the processing of event emissions. This changes the_execute()method ofEventEmitterbut provides a cleaner, more scalable, and efficient approach. - Renamed all debug flags from
debug_modetodebugfor enhanced clarity and consistency. - Renamed EventEmitter's
_execute()method to_process()to better reflect its purpose of processing event emissions.
Added
- Added
CeleryEventEmitterimplementation to leverage the Celery distributed task queue for event handling. - Added tests for
CeleryEventEmitterto validate its behavior and ensure proper operation. - Added documentation for
CeleryEventEmitter, including tutorials and API references.
Changed
- Restructured the documentation for event emitters tutorials and API references to improve organization and clarity.
- Updated the
contributing.mdpage to include the Troubleshooting Hatch Environment Errors section. - Updated the
EventEmitterAPI documentation to include theEventEmissionclass reference. - Updated
pyproject.tomlwith the new optional dependency forCeleryintegration. - Updated
mypyignore flags to properly silence specific false positive error codes.
Fixed
- Addressed minor errors in the Pyventus documentation.
Changelog
- Full Changelog: 0.2.1...0.3.0
- Contributors: @mdapena
v0.2.1
Release Note
Changed
- Updated docstring links throughout the package to refer to the official documentation.
- Updated the
RQEventEmitterAPI Reference and Tutorials docs to reflect the new optional import.
Fixed
- Resolved the issue where the
RQEventEmitterclass was automatically imported in the main package, requiring the installation of its optional dependency to use any of the package's core functionalities. It is now fully optional. - Fixed issues with invalid links in the documentation.
Changelog
- Full Changelog: 0.2.0...0.2.1
- Contributors: @mdapena