From 5134ec98467075188fac0660fda8bec1da0ead84 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 2 Nov 2026 13:43:05 +0000 Subject: [PATCH 1/3] Use absolute cross-references in docstrings Since mkdocstrings-python 2.0.9, relative cross-references are expanded from the path where an object is defined, not where it is documented. All our public symbols are defined in private modules and re-exported from `frequenz.dispatch`, so 6 of the current references can't be found anymore and the strict documentation build fails, blocking the bump. Counting the dots from the private module would fix the build, but it ties the references to the private module layout, breaks them on older mkdocstrings-python versions, and can make references to inherited members silently link to the wrong class. Relative references are also hard to read in an IDE, and only work in projects rendering our inherited docstrings if they enable `relative_crossrefs` too. All relative references are converted to absolute references to the public path of their target, which don't depend on any of that. The targets were taken from what mkdocstrings-python 2.0.8 expanded each reference to, and the built documentation has the same links as before, with both mkdocstrings-python 2.0.8 and 2.0.10. The references in the docstring of the private `DispatchScheduler.new_running_state_event_receiver()`, which is not rendered, are converted too, pointing to the public symbols they were meant for. Some paragraphs are rewrapped to fit the longer references. See frequenz-floss/frequenz-repo-config-python#655 for details. Signed-off-by: Leandro Lucarella --- src/frequenz/dispatch/__init__.py | 15 +++++------ src/frequenz/dispatch/_actor_dispatcher.py | 2 +- src/frequenz/dispatch/_bg_service.py | 16 ++++++------ src/frequenz/dispatch/_dispatcher.py | 29 ++++++++++++---------- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/frequenz/dispatch/__init__.py b/src/frequenz/dispatch/__init__.py index d91f400..d2e5dff 100644 --- a/src/frequenz/dispatch/__init__.py +++ b/src/frequenz/dispatch/__init__.py @@ -5,13 +5,14 @@ A small overview of the most important classes in this module: -* [`Dispatcher`][.Dispatcher]: The entry point for the API. -* [`Dispatch`][.Dispatch]: A dispatch type with lots of useful extra functionality. -* [`ActorDispatcher`][.ActorDispatcher]: A service to manage other actors based on - incoming dispatches. -* [`Created`][.Created], - [`Updated`][.Updated], - [`Deleted`][.Deleted]: Dispatch event types. +* [`Dispatcher`][frequenz.dispatch.Dispatcher]: The entry point for the API. +* [`Dispatch`][frequenz.dispatch.Dispatch]: A dispatch type with lots of useful extra + functionality. +* [`ActorDispatcher`][frequenz.dispatch.ActorDispatcher]: A service to manage other + actors based on incoming dispatches. +* [`Created`][frequenz.dispatch.Created], + [`Updated`][frequenz.dispatch.Updated], + [`Deleted`][frequenz.dispatch.Deleted]: Dispatch event types. """ diff --git a/src/frequenz/dispatch/_actor_dispatcher.py b/src/frequenz/dispatch/_actor_dispatcher.py index a8a8bc5..5386fd6 100644 --- a/src/frequenz/dispatch/_actor_dispatcher.py +++ b/src/frequenz/dispatch/_actor_dispatcher.py @@ -45,7 +45,7 @@ def components(self) -> TargetComponents: """The target components. Warning: Deprecated in v0.10.3 - Use [`target`][..target] instead. + Use [`target`][frequenz.dispatch.DispatchInfo.target] instead. """ return self.target diff --git a/src/frequenz/dispatch/_bg_service.py b/src/frequenz/dispatch/_bg_service.py index 54bbe5f..67239d5 100644 --- a/src/frequenz/dispatch/_bg_service.py +++ b/src/frequenz/dispatch/_bg_service.py @@ -180,22 +180,22 @@ async def new_running_state_event_receiver( """Create a new receiver for running state events of the specified type. `merge_strategy` is an instance of a class derived from - [`MergeStrategy`][....MergeStrategy]. Available strategies + [`MergeStrategy`][frequenz.dispatch.MergeStrategy]. Available strategies are: - * [`MergeByType`][....MergeByType] — merges all dispatches + * [`MergeByType`][frequenz.dispatch.MergeByType] — merges all dispatches of the same type. - * [`MergeByTypeTarget`][....MergeByTypeTarget] — merges all + * [`MergeByTypeTarget`][frequenz.dispatch.MergeByTypeTarget] — merges all dispatches of the same type and target. * `None` — no merging, just send all events. You can make your own identity-based strategy by subclassing - [`MergeByType`][....MergeByType] and overriding - the [`identity()`][....MergeStrategy.identity] method. If + [`MergeByType`][frequenz.dispatch.MergeByType] and overriding + the [`identity()`][frequenz.dispatch.MergeStrategy.identity] method. If you require a more complex strategy, you can subclass - [`MergeStrategy`][....MergeStrategy] directly and implement - both the [`identity()`][....MergeStrategy.identity] and - [`filter()`][....MergeStrategy.filter] methods. + [`MergeStrategy`][frequenz.dispatch.MergeStrategy] directly and implement + both the [`identity()`][frequenz.dispatch.MergeStrategy.identity] and + [`filter()`][frequenz.dispatch.MergeStrategy.filter] methods. Running intervals from multiple dispatches will be merged, according to the chosen strategy. diff --git a/src/frequenz/dispatch/_dispatcher.py b/src/frequenz/dispatch/_dispatcher.py index 77762c8..2c8678d 100644 --- a/src/frequenz/dispatch/_dispatcher.py +++ b/src/frequenz/dispatch/_dispatcher.py @@ -35,9 +35,11 @@ class Dispatcher(BackgroundService): The receivers shortly explained: - * [Lifecycle events receiver][.new_lifecycle_events_receiver]: + * [Lifecycle events + receiver][frequenz.dispatch.Dispatcher.new_lifecycle_events_receiver]: Receives an event whenever a dispatch is created, updated or deleted. - * [Running status change receiver][.new_running_state_event_receiver]: + * [Running status change + receiver][frequenz.dispatch.Dispatcher.new_running_state_event_receiver]: Receives an event whenever the running status of a dispatch changes. The running status of a dispatch can change due to a variety of reasons, such as but not limited to the dispatch being started, stopped, modified @@ -324,22 +326,23 @@ async def start_managing( ) -> None: """Manage actors for a given dispatch type. - Creates and manages an - [`ActorDispatcher`][...ActorDispatcher] for the given type that will - start, stop and reconfigure actors based on received dispatches. + Creates and manages an [`ActorDispatcher`][frequenz.dispatch.ActorDispatcher] + for the given type that will start, stop and reconfigure actors based on + received dispatches. - You can await the [`Dispatcher`][...Dispatcher] instance to block - until all types registered with [`start_managing`][..start_managing] are stopped - using [`stop_managing`][..stop_managing]. + You can await the [`Dispatcher`][frequenz.dispatch.Dispatcher] instance to block + until all types registered with + [`start_managing`][frequenz.dispatch.Dispatcher.start_managing] are stopped + using [`stop_managing`][frequenz.dispatch.Dispatcher.stop_managing]. "Merging" means that when multiple dispatches are active at the same time, the intervals are merged into one. This also decides how instances are mapped from dispatches to actors: - * [`MergeByType`][...MergeByType] — All dispatches map to + * [`MergeByType`][frequenz.dispatch.MergeByType] — All dispatches map to one single instance identified by the dispatch type and dry_run status. - * [`MergeByTypeTarget`][...MergeByTypeTarget] — A + * [`MergeByTypeTarget`][frequenz.dispatch.MergeByTypeTarget] — A dispatch maps to an instance identified by the dispatch type, dry_run status and target. So different dispatches with equal type and target will map to the same instance. @@ -457,12 +460,12 @@ async def new_running_state_event_receiver( - The dispatch was deleted `merge_strategy` is an instance of a class derived from - [`MergeStrategy`][...MergeStrategy]. Available strategies + [`MergeStrategy`][frequenz.dispatch.MergeStrategy]. Available strategies are: - * [`MergeByType`][...MergeByType] — merges all dispatches + * [`MergeByType`][frequenz.dispatch.MergeByType] — merges all dispatches of the same type. - * [`MergeByTypeTarget`][...MergeByTypeTarget] — merges all + * [`MergeByTypeTarget`][frequenz.dispatch.MergeByTypeTarget] — merges all dispatches of the same type and target. * `None` — no merging, just send all events (default). From c906c20f06096851b56b0a6ae74b26fa31614eb2 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 2 Nov 2026 13:43:07 +0000 Subject: [PATCH 2/3] Disable mkdocstrings relative cross-references No docstring uses relative cross-references anymore, so the option is removed to stop new ones from being added. Absolute references to public paths are the convention from now on. See frequenz-floss/frequenz-repo-config-python#655 for details. Signed-off-by: Leandro Lucarella --- mkdocs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index d6b8be9..92ff39a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -112,7 +112,6 @@ plugins: show_source: true show_symbol_type_toc: true signature_crossrefs: true - relative_crossrefs: true inventories: # See https://mkdocstrings.github.io/python/usage/#import for details - https://docs.python.org/3/objects.inv From 3d2a14a9f4b2c0d51197118dbd6534a8697b1af0 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 2 Nov 2026 13:43:19 +0000 Subject: [PATCH 3/3] Update release notes Signed-off-by: Leandro Lucarella --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6b1698e..9f242af 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -8,3 +8,4 @@ * Fixed documentation cross-references to dependencies by updating the mkdocstrings inventories to match the minimum dependency versions and adding the missing `frequenz-client-base` inventory. * Declared the missing direct dependencies `frequenz-client-common`, `frequenz-core` and `grpcio`, which were previously only pulled in indirectly through `frequenz-client-dispatch`. +* Docstrings now use absolute cross-references to public paths instead of relative ones. Relative cross-references are expanded from the module where an object is defined since mkdocstrings-python 2.0.9, which broke some links, and projects rendering docstrings inherited from this library needed `relative_crossrefs: true` for them to work at all. See [frequenz-repo-config-python#655](https://github.com/frequenz-floss/frequenz-repo-config-python/issues/655) for details.