Add mDNS/Bonjour discovery for remote apps (no hard-coded ports)#96
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
List every myTk app advertised on the LAN (name + address) without connecting to any, complementing --discover which targets one. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dccote
force-pushed
the
feature/remote-network-discovery
branch
from
July 7, 2026 16:43
05ee861 to
eb60903
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RemoteControllableapps can now publish themselves on the local network and befound by name, so clients no longer need a hard-coded host/port. Built on the
existing XML-RPC remote layer; the transport is unchanged.
What's new
Server —
RemoteControllable.advertise_remote(port=0, host="0.0.0.0", service_type="_mytk._tcp.local.", addr=None)starts the remote server on an OS-picked free port and announces it over mDNS.
app_namebecomes the service instance name and is copied into the TXT record.stop_remote()now also withdraws the announcement.Client —
mytk.discover(app_name=None, service_type="_mytk._tcp.local.", timeout=3.0)browses for an advertised server and returns a proxy through the existing
connect(), soRemoteAppMismatchverification still applies.app_namefilters by the advertised identity.
CLI —
mytk-remote --discoverlocates the server over mDNS instead of using--host/--port;--app-nameselects which app,--service-type/--timeouttune the browse. Explicit
--host/--portbehavior is unchanged.Usage
mytk-remote --discover --list mytk-remote --discover --app-name Microscope "status()"Packaging
New optional extra
mytk[remote](pulls inzeroconf).advertise_remote()installs it on demand via
ModulesManager(Tk context);discover()imports itdirectly and raises a clear
ImportErrorif missing.Design notes
_mytk._tcp), not thetransport, per DNS-SD; multiple apps share it and are told apart by
instance name /
app_name.host="0.0.0.0"onadvertise_remote()makes the service reachablefrom other machines (mDNS is a LAN feature); pass
127.0.0.1to keep itsame-machine only.
start_remote()still defaults to localhost.Tests
mytk/tests/testRemoteDiscovery.pycoversdiscover()browsing,app_namefiltering, timeout, and the missing-
zeroconfImportError, plus the CLI--discoverwiring. Hermetic via a fakezeroconfmodule — no multicast, nosockets, no Tk window.
Compatibility
Backward compatible: no changes to existing signatures/defaults of
start_remote,connect, or the CLI's--host/--portpath.zeroconfisonly needed when discovery is used.
🤖 Generated with Claude Code