Skip to content

Releases: mdapena/pyventus

v0.8.0

01 Mar 16:04
9eaa246

Choose a tag to compare

Release Note

Added

  • Added a new optional constructor parameter to the AsyncIOProcessingService called enforce_submission_order. When True, 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 AsyncIOProcessingService called force_async. When True, synchronous callbacks submitted to the processing service will be forced to run asynchronously through the asyncio.to_thread() function. Default: False.

  • Added a new property to the AsyncIOProcessingService called task_name, which returns the name used for all tasks created by a processing service instance.

  • Added a new property to the AsyncIOProcessingService called task_count, which returns the number of tasks that are currently active within an AsyncIOProcessingService instance.

  • Added a new class method to the AsyncIOProcessingService called all_tasks(), which returns all currently active tasks across all instances.

  • Added a new class method to the AsyncIOProcessingService called guard(), which is a decorator for async callables that ensures all active tasks across all instances in the current event loop are completed before the decorated coroutine continues.

  • Added a new Observable subclass called ObservableValue, a value-centric observable that focuses on a single value and its changes over time.

  • Added a new Observable subclass called ObservableStream, a data flow-centric observable that focuses exclusively on the stream of its entries over time.

Changed

  • Updated internal methods of the AsyncIOProcessingService for standardized naming.

  • Updated the wait_for_tasks() method of the AsyncIOProcessingService to 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 the AsyncIOProcessingService to handle task submissions based on the enforce_submission_order and force_async configurations.

  • Updated the _emit_next() method of the Observable base class to incorporate a new optional parameter called subscribers, which corresponds to the collection of subscribers to be used for the notification.

  • Updated the _emit_error() method of the Observable base class to incorporate a new optional parameter called subscribers, which corresponds to the collection of subscribers to be used for the notification.

  • Updated the _emit_complete() method of the Observable base class to incorporate a new optional parameter called subscribers, which corresponds to the collection of subscribers to be used for the notification.

Changelog

v0.7.2

11 Nov 12:30
0dd1ee6

Choose a tag to compare

Release Note

Changed

  • Added support for Python 3.14, ensuring compatibility with the latest features and improvements.

  • Bumped the upload-artifact action to v5 in the publish-to-pypi.yml workflow.

  • Bumped the download-artifact action to v6 in the publish-to-pypi.yml workflow.

  • Bumped the setup-python action to v6 in the deploy-docs.yml, publish-to-pypi.yml, and run-tests.yml workflows.

  • Bumped the checkout action to v5 in the deploy-docs.yml, publish-to-pypi.yml, and run-tests.yml workflows.

Changelog

v0.7.1

25 May 13:05
0d3b42a

Choose a tag to compare

Release Note

Changed

  • Refactored the StdOutLogger to improve usability, configuration, and standardization of logging messages.

  • Enabled a config() method in the StdOutLogger for straightforward configuration of the Pyventus logger.

  • Introduced a critical() method in both the StdOutLogger and Logger classes for logging critical-level messages.

  • Updated the error() method in both the StdOutLogger and Logger classes to include the exc_info parameter, 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 Observable class by including exception information in error logs for better debugging when errors occur.

Changelog

v0.7.0

07 Jan 06:02
a2ed1b8

Choose a tag to compare

Release Note

Breaking Changes

  • The typing-extensions package 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.events instead of directly from pyventus. 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 EventEmitter has been replaced with composition using the new ProcessingService interface. This interface establishes a common ground for processing calls, such as event emissions, in a decoupled and flexible manner. The EventEmitter is now a concrete class that requires a ProcessingService instance, referred to as event_processor, for initialization. These changes not only preserve the overall behavior and workflow of the EventEmitter but also enhance its modularity and flexibility.

  • The EventLinker class 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 the EventLinker class:

    • The inner class EventLinkageWrapper was renamed to EventLinkerSubCtx for consistency with the new concept of a subscription context and now extends from the base class SubscriptionContext. 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 a set of all registered events instead of a list with non-duplicated events.
    • The method get_event_handlers() was renamed to get_subscribers() for consistency, and it now returns a setof all registered subscribers instead of a list with non-duplicated subscribers.
    • The method get_events_by_event_handler() was renamed to get_events_from_subscribers() for consistency. It now returns a set of events associated with the specified subscribers instead of a list of 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 to get_subscribers_from_events() for consistency. It now returns a set of subscribers associated with the specified events instead of a list of non-duplicated subscribers associated with the provided events. Additionally, a new flag called pop_onetime_subscribers was added to remove and return those subscribers that are one-time subscriptions.
    • The method unsubscribe() was renamed to remove() for consistency with the new concept of subscription and the encapsulation of the unsubscription process through the teardown_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 to remove_subscriber() for consistency.
    • Parameters named event_handler were renamed to subscriber for consistency.
  • The EventHandler has been refactored from a class to an interface, outlining the overall workflow and essential protocols for event handling. However, the previous implementation of the EventHandler has been transitioned to one of its concrete classes named EventSubscriber. This new EventSubscriber class not only implements the EventHandler interface but also combines it with the Subscription base 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 Observable base class, which defines a lazy push-style notification mechanism for streaming data to subscribers.
    • Added the ObservableTask class, 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 Observer interface, which defines the overall workflow and essential protocols for responding to notifications from an observable.
    • Added the Subscriber class, which combines the Observer interface with the Subscription base class to provide a convenient way to respond to state changes emitted by an observable and manage the subscription lifecycle.
  • Added the Unsubscribable interface, which provides a standardized method for objects to unsubscribe from a source and release any associated resources.

  • Added the Subscription base class to simplify subscription management and resource cleanup with a teardown_callback that is called during unsubscription.

  • Added the SubscriptionContext base 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 MultiBidict data 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 ProcessingService interface to define flexible execution strategies for various use cases. This release includes the following concrete implementations:

    • AsyncIOProcessingService: A processing service that utilizes the AsyncIO framework to handle the execution of calls.
    • CeleryProcessingService: A processing service that utilizes the Celery framework to handle the execution of calls.
    • ExecutorProcessingService: A processing service that utilizes the Python's Executor to handle the execution of calls.
    • FastAPIProcessingService: A processing service that uses FastAPI's BackgroundTasks to handle the execution of calls.
    • RedisProcessingService: A processing service that utilizes the Redis Queue framework to handle the execution of calls.
  • Added the CallableWrapper class to encapsulate callables and provide a unified asynchronous interface for their execution.

  • Added new features to the EventLinker class, 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_subctx parameter in the once() and on() methods to configure the EventLinkerSubCtx behavior and optimize the subscription context based on user needs.
  • Introduced the EventSubscriber class, which combines event handling capabilities with subscription lifecycle management.

  • A new benchmarks package has been added to the tests directory for performance evaluation of Pyventus. This release introduces the EventEmitterBenchmark, which measures the efficiency of the EventEmitter in 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 the EventEmitter to support the emission of global events (...).

  • Moved callback utilities to a dedicated module within pyventus.core for improved organization and reusability.

  • Standardized the structure of Python classes and their representation, including the use of the @override() decorator for consistency and mypy static type checking.

  • Standardized the structure of the pyproject.toml file.

  • Enhanced Pyventus logs by adding process and thread IDs for better debugging.

  • Switched from the Black formatter to Ruff for 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, including pytest-asyncio from version 0.21.0 to 0.24.0, to enable global configuration of the asyncio_mode.

  • Simplified the EventCallbackType type alias by removing the unnecessary ParamSpec.

  • Refactored the test suite to improve validation across all package features, ensuring correctness and ac...

Read more

v0.6.0

19 Oct 13:49
e31bf6d

Choose a tag to compare

Release Note

Added

  • Added support for Python 3.13, ensuring compatibility with the latest features and improvements.
  • Added mike package integration to mkdocs-material for documentation versioning. This allows users to access previous documentation alongside new changes, ensuring that legacy content remains intact for reference. Additionally, a new dev documentation 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-artifact and cache actions to v4 in the publish-to-pypi.yml workflow.
  • Updated the deploy-docs.yml workflow to deploy both dev and versioned documentation using mike's CLI commands.

Fixed

  • Fixed broken links to non-versioned documentation by adding a custom 404.html page to gh-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

v0.5.0

09 Apr 22:20
05d07a8

Choose a tag to compare

Release Note

Breaking Changes

  • Removed the base Event class due to improved event semantics and unnecessary redundancy.
  • Renamed the get_event_registry() method of EventLinker to get_registry().
  • Renamed the __event_registry inner property of EventLinker to __registry.
  • Renamed the get_events_by_handler() method of EventLinker to get_events_by_event_handler().
  • Renamed the get_handlers_by_events() method of EventLinker to get_event_handlers_by_events().
  • Renamed the protected method _executor_callback() of the ExecutorEventEmitter to _callback().
  • Renamed the task name of CeleryEventEmitter from _executor to pyventus_executor to avoid collisions with other task names.

Added

  • Added __slots__ to EventLinkageWrapper class for more efficient memory usage.
  • Extended support for subscription and emission of any dataclass object, removing the limitation of only Event subclasses.
  • Added the force_async parameter to the EventHandler class and EventLinker subscription methods to be able to optimize the execution of sync callbacks 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 the onAny() method but with a Pythonic syntax.
  • Added the mkdocs-material social cards plugin, 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 EventLinker and EventEmitter classes.
  • Improved validation of variable instances in the event emitters, EventLinker, and EventHandler.
  • Updated and improved the test suite to ensure accurate validation and consistency.
  • Enabled creation date for the mkdocs git-revision-date-localized plugin.
  • Replaced the mkdocs git-authors plugin with the git-committers plugin.
  • 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 once flag in the EventHandler class.

Fixed

  • Fixed and standardized all package docstrings and code comments for consistency and clarity.
  • Addressed minor errors and details in the documentation.

Changelog

v0.4.1

31 Jan 03:11
3956ed4

Choose a tag to compare

Release Note

Changed

  • Optimized the size of the source distribution (sdist) build by including only essential files and directories, such
    as the /src and /tests directories, as well as the following files: .gitignore, pyproject.toml,
    CITATION.cff, README, and LICENSE.
  • Refactored documentation dependencies into an optional dependency called docs.
  • Updated the deploy-docs.yml GitHub workflow to leverage the new optional dependency docs.
  • Updated the EventEmission class with the @final decorator 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

v0.4.0

06 Jan 07:50
e8fcf5f

Choose a tag to compare

Release Note

Added

  • Added FastAPIEventEmitter implementation to facilitate seamless integration with the FastAPI framework.
  • Added tests for FastAPIEventEmitter to validate its behavior and ensure proper operation.
  • Added documentation for FastAPIEventEmitter, including tutorials and API references.
  • Integrated the Coveralls.io workflow 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.toml with the new optional dependency for FastAPI integration.

Fixed

  • Addressed minor errors in the Pyventus documentation to improve accuracy and clarity.

Changelog

v0.3.0

29 Dec 19:29
5a446e0

Choose a tag to compare

Release Note

Breaking Changes

  • Introduced EventEmission object to encapsulate the processing of event emissions. This changes the _execute() method of EventEmitter but provides a cleaner, more scalable, and efficient approach.
  • Renamed all debug flags from debug_mode to debug for enhanced clarity and consistency.
  • Renamed EventEmitter's _execute() method to _process() to better reflect its purpose of processing event emissions.

Added

  • Added CeleryEventEmitter implementation to leverage the Celery distributed task queue for event handling.
  • Added tests for CeleryEventEmitter to 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.md page to include the Troubleshooting Hatch Environment Errors section.
  • Updated the EventEmitter API documentation to include the EventEmission class reference.
  • Updated pyproject.toml with the new optional dependency for Celery integration.
  • Updated mypy ignore flags to properly silence specific false positive error codes.

Fixed

  • Addressed minor errors in the Pyventus documentation.

Changelog

v0.2.1

17 Dec 04:10
24d89d7

Choose a tag to compare

Release Note

Changed

  • Updated docstring links throughout the package to refer to the official documentation.
  • Updated the RQEventEmitter API Reference and Tutorials docs to reflect the new optional import.

Fixed

  • Resolved the issue where the RQEventEmitter class 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