From 4134726ec41f7461ebb22ed90bbc5b88aeaba40c Mon Sep 17 00:00:00 2001 From: goodboy Date: Tue, 25 Aug 2026 19:59:17 -0400 Subject: [PATCH] Pass `pub_service` directly to stream RPC Keep the `@pub` docstring example's remote target namespace addressable by passing the module-level function directly to `Portal.open_stream_from()`. Forward the topic and task-name inputs as RPC kwargs instead of wrapping the target in a `functools.partial` object that resolves to the wrong namespace path. Review: PR #484 (OpenCode) https://github.com/goodboy/tractor/pull/484#pullrequestreview-5025383596 (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`)) --- tractor/experimental/_pubsub.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tractor/experimental/_pubsub.py b/tractor/experimental/_pubsub.py index 76c2cea0..e23fdc71 100644 --- a/tractor/experimental/_pubsub.py +++ b/tractor/experimental/_pubsub.py @@ -217,7 +217,6 @@ def pub( .. code:: python - from functools import partial import tractor async with tractor.open_nursery() as n: @@ -226,11 +225,9 @@ def pub( enable_modules=[__name__], ) async with portal.open_stream_from( - partial( # func to execute in it - pub_service, - topics=('clicks', 'users'), - task_name='source1', - ) + pub_service, # func to execute in it + topics=('clicks', 'users'), + task_name='source1', ) as stream: async for value in stream: print(f"Subscriber received {value}")