Skip to content

Use absolute cross-references in docstrings - #323

Merged
Marenz merged 3 commits into
frequenz-floss:v1.x.xfrom
llucax:absolute-crossrefs
Nov 4, 2026
Merged

Marenz merged 3 commits into
frequenz-floss:v1.x.xfrom
llucax:absolute-crossrefs

Conversation

@llucax

@llucax llucax commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

This converts every relative cross-reference in the docstrings to an absolute reference to the target's public path, and removes relative_crossrefs: true from mkdocs.yml, as proposed in frequenz-floss/frequenz-repo-config-python#655. It's the same change as frequenz-floss/frequenz-core-python#207 and frequenz-floss/frequenz-channels-python#566.

It unblocks #321: with mkdocstrings-python 2.0.9 and later, 6 references in Dispatcher can't be found anymore and the strict docs build fails. Now the docs build cleanly with both 2.0.8 and 2.0.10, with the same links as before.

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 <luca-frequenz@llucax.com>
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 <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax added the part:docs Affects the documentation label Nov 2, 2026
@github-actions github-actions Bot added part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) part:dispatcher Affects the high-level dispatcher interface labels Nov 2, 2026
@llucax
llucax marked this pull request as ready for review November 4, 2026 12:41
@llucax
llucax requested a review from a team as a code owner November 4, 2026 12:41
@llucax
llucax requested review from Marenz and ela-kotulska-frequenz and removed request for a team November 4, 2026 12:41
@llucax
llucax enabled auto-merge November 4, 2026 12:41
@Marenz
Marenz added this pull request to the merge queue Nov 4, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit c8f98c8 Nov 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:dispatcher Affects the high-level dispatcher interface part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants