Skip to content

Fix the actor examples for the frequenz-channels v1 API - #1465

Open
llucax wants to merge 3 commits into
frequenz-floss:v1.x.xfrom
llucax:fix-broadcast-name-examples
Open

llucax wants to merge 3 commits into
frequenz-floss:v1.x.xfrom
llucax:fix-broadcast-name-examples

Conversation

@llucax

@llucax llucax commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The compose.py and select.py examples in the actor module guide were written for the pre-v1 frequenz-channels API and fail when run: Broadcast takes name as a keyword-only argument, select()/selected_from() no longer live in frequenz.channels.util, and Selected exposes message instead of value.

They were never caught because their fences have a title option, which makes the example linter skip the block entirely (frequenz-floss/frequenz-repo-config-python#652, fixed by frequenz-floss/frequenz-repo-config-python#653). Fixing them now means the repo-config bump that brings that fix won't break CI.

Both examples now run and print the documented output.

Note: the EchoActor example at line 184 still fails the example linter until #1464 is merged.

llucax added 3 commits October 5, 2026 16:44
The `compose.py` and `select.py` examples in the actor module guide
create `Broadcast` channels passing the name positionally, but `name` is
a keyword-only argument in frequenz-channels v1, so the examples fail
with a `TypeError`.

These examples were never linted because their fences have a `title`
option, which made the example linter skip them
(frequenz-floss/frequenz-repo-config-python#652).

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
`select()` and `selected_from()` are now imported from
`frequenz.channels` (`frequenz.channels.util` is gone), and `Selected`
exposes the received message as `message` instead of `value`, so the
example failed to import and, once fixed, raised an `AttributeError`.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The notes said both messages come from `input_channel_1`, but the
second one comes from `input_channel_2`. The expected output was also
missing the `EchoActor finished` line the actor prints when it stops.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@github-actions github-actions Bot added the part:actor Affects an actor ot the actors utilities (decorator, etc.) label Oct 5, 2026
@llucax llucax added this to the v1.0.0-rc2212 milestone Oct 5, 2026
@llucax llucax added the cmd:skip-release-notes It is not necessary to update release notes for this PR label Oct 5, 2026
@llucax
llucax marked this pull request as ready for review October 5, 2026 16:50
@llucax
llucax requested a review from a team as a code owner October 5, 2026 16:50
@llucax
llucax requested review from florian-wagner-frequenz and removed request for a team October 5, 2026 16:50
@llucax llucax added part:docs Affects the documentation type:bug Something isn't working labels Oct 5, 2026
@llucax
llucax enabled auto-merge October 5, 2026 16:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmd:skip-release-notes It is not necessary to update release notes for this PR part:actor Affects an actor ot the actors utilities (decorator, etc.) part:docs Affects the documentation type:bug Something isn't working

Projects

Status: To do

Development

Successfully merging this pull request may close these issues.

1 participant