Skip to content

start_remote() auto-registers @remote_command methods#95

Merged
dccote merged 1 commit into
mainfrom
auto-register-remote-commands
Jul 7, 2026
Merged

start_remote() auto-registers @remote_command methods#95
dccote merged 1 commit into
mainfrom
auto-register-remote-commands

Conversation

@dccote

@dccote dccote commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Simplifies the remote API surface based on feedback. start_remote() now auto-registers @remote_command-tagged methods, so register_remote_commands() no longer needs to be called manually:

class MyApp(App, RemoteControllable):
    @remote_command
    def turn_on(self): ...

app = MyApp(name="Server")
app.start_remote()     # tagged methods are registered automatically
app.mainloop()

Why not just remove app.remote?

app.remote() isn't a parallel feature to @remote_command — it's the engine underneath it. register_remote_commands() calls self.remote(...) for each tagged method, so it can't be deleted. Instead this PR reframes it: docs now present @remote_command as the way to expose methods, and app.remote(...) as the low-level primitive it builds on (still there for free functions or dynamic runtime registration). Nothing is removed; fully backward compatible.

Changes

  • start_remote() calls register_remote_commands() before publishing (idempotent — remote() overwrites by name).
  • register_remote_commands() documented as auto-called / rarely needed.
  • Module + method docstrings lead with @remote_command; remote() reframed as the primitive.
  • No API removed; existing self.remote(...) / @app.remote usage still works.

Tests

  • New test_start_remote_auto_registers_commands (tagged methods exposed with no explicit register call).
  • CLI tests dropped their explicit register_remote_commands() to exercise auto-registration through start_remote.
  • Full suite green.

Targeted for release v1.7.1 (backward-compatible refinement).

🤖 Generated with Claude Code

start_remote() now calls register_remote_commands() before publishing, so
tagged methods just work without a separate call. The explicit method remains
available and idempotent.

Docs now present @remote_command as the primary way to expose methods and
frame app.remote(...) as the low-level primitive it builds on (kept for free
functions / dynamic registration). No behavior removed; fully backward
compatible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dccote
dccote merged commit e203834 into main Jul 7, 2026
11 checks passed
@dccote
dccote deleted the auto-register-remote-commands branch July 7, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant