Releases: mdapena/pyventus
v0.7.1
Release Note
Changed
-
Refactored the
StdOutLogger
to improve usability, configuration, and standardization of logging messages. -
Enabled a
config()
method in theStdOutLogger
for straightforward configuration of the Pyventus logger. -
Introduced a
critical()
method in both theStdOutLogger
andLogger
classes for logging critical-level messages. -
Updated the
error()
method in both theStdOutLogger
andLogger
classes to include theexc_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
- Full Changelog: 0.7.0...0.7.1
- Contributors: @mdapena
v0.7.0
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 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 reac 8000 tive programming features, enabling optimized imports based on the required paradigm. -
The inheritance structure of the
EventEmitter
has been replaced with composition using the newProcessingService
interface. This interface establishes a common ground for processing calls, such as event emissions, in a decoupled and flexible manner. TheEventEmitter
is now a concrete class that requires aProcessingService
instance, referred to asevent_processor
, for initialization. These changes not only preserve the overall behavior and workflow of theEventEmitter
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 theEventLinker
class:- The inner class
EventLinkageWrapper
was renamed toEventLinkerSubCtx
for 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 aset
of all registered events instead of alist
with non-duplicated events. - The method
get_event_handlers()
was renamed toget_subscribers()
for consistency, and it now returns aset
of all registered subscribers instead of alist
with non-duplicated subscribers. - The method
get_events_by_event_handler()
was renamed toget_events_from_subscribers()
for consistency. It now returns aset
of events associated with the specified subscribers instead of alist
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 toget_subscribers_from_events()
for consistency. It now returns aset
of subscribers associated with the specified events instead of alist
of non-duplicated subscribers associated with the provided events. Additionally, a new flag calledpop_onetime_subscribers
was 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_handler
were renamed tosubscriber
for consistency.
- The inner class
-
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 theEventHandler
has been transitioned to one of its concrete classes namedEventSubscriber
. This newEventSubscriber
class not only implements theEventHandler
interface but also combines it with theSubscription
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 theObserver
interface with theSubscription
base class to provide a convenient way to respond to state changes emitted by an observable and manage the subscription lifecycle.
- Added the
-
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 ateardown_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 theAsyncIO
framework to handle the execution of calls.CeleryProcessingService
: A processing service that utilizes theCelery
framework to handle the execution of calls.ExecutorProcessingService
: A processing service that utilizes the Python'sExecutor
to handle the execution of calls.FastAPIProcessingService
: A processing service that uses FastAPI'sBackgroundTasks
to handle the execution of calls.RedisProcessingService
: A processing service that utilizes theRedis 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 theonce()
andon()
methods to configure theEventLinkerSubCtx
behavior and optimize the subscription context based on user needs.
- Introduced the
-
Introduced the
EventSubscriber
class, which combines event handling capabilities with subscription lifecycle management. -
A new
benchmarks
package has been added to thetests
directory for performance evaluation of Pyventus. This release introduces theEventEmitterBenchmark
, which measures the efficiency of theEventEmitter
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 theEventEmitter
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 andmypy
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 toRuff
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
, includingpytest-asyncio
from version0.21.0
to0.24.0
, to enable global configuration of theasyncio_mode
. -
Simplified the
EventCallbackType
type 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
mike
package integration tomkdocs-material
for documentation versioning. This allows users to access previous documentation alongside new changes, ensuring that legacy content remains intact for reference. Additionally, a newdev
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
andcache
actions tov4
in thepublish-to-pypi.yml
workflow. - Updated the
deploy-docs.yml
workflow to deploy bothdev
and versioned documentation usingmike
's CLI commands.
Fixed
- Fixed broken links to non-versioned documentation by adding a custom
404.html
page 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
Event
class due to improved event semantics and unnecessary redundancy. - Renamed the
get_event_registry()
method ofEventLinker
toget_registry()
. - Renamed the
__event_registry
inner property ofEventLinker
to__registry
. - Renamed the
get_events_by_handler()
method ofEventLinker
toget_events_by_event_handler()
. - Renamed the
get_handlers_by_events()
method ofEventLinker
toget_event_handlers_by_events()
. - Renamed the protected method
_executor_callback()
of theExecutorEventEmitter
to_callback()
. - Renamed the task name of
CeleryEventEmitter
from_executor
topyventus_executor
to avoid collisions with other task names.
Added
- Added
__slots__
toEventLinkageWrapper
class for more efficient memory usage. - Extended support for subscription and emission of any
dataclass
object, removing the limitation of onlyEvent
subclasses. - Added the
force_async
parameter to theEventHandler
class andEventLinker
subscription methods to be able to optimize the execution ofsync
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 theonAny()
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
andEventEmitter
classes. - 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-localized
plugin. - Replaced the mkdocs
git-authors
plugin with thegit-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 theEventHandler
class.
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/src
and/tests
directories, 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.yml
GitHub workflow to leverage the new optional dependencydocs
. - 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
- Full Changelog: 0.4.0...0.4.1
- Contributors: @mdapena
v0.4.0
Release Note
Added
- Added
FastAPIEventEmitter
implementation to facilitate seamless integration with theFastAPI
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 forFastAPI
integration.
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
EventEmission
object to encapsulate the processing of event emissions. This changes the_execute()
method ofEventEmitter
but provides a cleaner, more scalable, and efficient approach. - Renamed all debug flags from
debug_mode
todebug
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 theEventEmission
class reference. - Updated
pyproject.toml
with the new optional dependency forCelery
integration. - Updated
mypy
ignore 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
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
- Full Changelog: 0.2.0...0.2.1
- Contributors: @mdapena
v0.2.0
Release Note
Added
- Introduced the
publish to PyPI
workflow, automating the uploading of package builds when new releases are created. - Added the
mkdocs-git-authors
plugin to display git authors of a markdown page in the documentation. - Added badges to the main page of the documentation as well as the readme file.
- Added a code of conduct for the project, using the Contributor Covenant v2.1.
- Included a
CITATION.cff
file to facilitate academic citations.
Changed
- Renamed the
tests.yml
workflow torun-tests.yml
. - Updated the
deploy-docs.yml
workflow with themkdocs-git-authors
plugin dependency. - Modified the
mkdocs.yml
config file by adding thesite_url
andsite_author
properties. - Updated the
pyproject.toml
file with themkdocs-git-authors
plugin dependency and python package keywords.
Fixed
- Fixed the python version in the
deploy-docs.yml
workflow. - Resolved issues with relative links in the documentation.
Changelog
- Full Changelog: 0.1.0...0.2.0
- Contributors: @mdapena
v0.1.0
Initial Implementation
This release introduces Pyventus v0.1.0, a modern and robust Python package for event-driven programming. Pyventus provides developers with a comprehensive suite of tools and utilities to define, emit, and orchestrate events. It empowers developers to build scalable, extensible, and loosely-coupled event-driven applications.
- Implementation Details: The first implementation includes all the core functionalities of the package, encompassing events, event linkers, event emitters, event handlers, and more.
- Testing and Coverage: This release includes a test suite that verifies the correctness of the package implementation. It also integrates code coverage, achieving 100% test coverage. The tests are configured to run automatically via GitHub Actions on both push and pull requests to the master branch.
- Formatter and Lint Configuration: A formatter and lint configuration have been added to the project. This ensures consistent code style, maintainability, and adherence to the established coding standards defined in the project documentation.
- Documentation: Additionally, this release includes comprehensive documentation for the package. The documentation covers the main page, a detailed getting started guide, tutorials, API reference, and release notes.