From e39b637300fa58bbefd597e5386d1cc13ba5b38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20C=C3=B4t=C3=A9?= Date: Tue, 7 Jul 2026 13:35:47 -0400 Subject: [PATCH] Rename the remote command-line client to `mytk` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The remote CLI is the one general tool to probe/--list/--browse/--discover and drive any RemoteControllable app. Rename its console script from `mytk-remote` to `mytk`. The short-lived `mytk-remote` name (introduced in 1.7.0) is dropped entirely — no alias — and all references (docstrings, the server thread name, tests) are updated for consistency. `python -m mytk --remote` still works. Behavior, flags, syntax and exit codes are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 4 ++++ mytk/remote.py | 2 +- mytk/remotecli.py | 24 ++++++++++++------------ mytk/remotecontrollable.py | 4 ++-- mytk/tests/testRemoteDiscovery.py | 4 ++-- pyproject.toml | 2 +- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f652014..c7e30d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ All notable changes to myTk are documented here. other optional features, `zeroconf` is also installed on demand at first use of `advertise_remote()`; `discover()` imports it directly and raises a clear `ImportError` if missing (a client is often a plain script with no Tk root). +- **The remote command-line client is now the `mytk` command**, replacing the + short-lived `mytk-remote` console script (introduced in 1.7.0, now removed — + use `mytk`, or `python -m mytk --remote`). Use it to probe, `--list`, + `--browse`, `--discover` and drive any RemoteControllable app. ## [1.7.1] ### Changed diff --git a/mytk/remote.py b/mytk/remote.py index 34e50c1..7eafdda 100644 --- a/mytk/remote.py +++ b/mytk/remote.py @@ -156,7 +156,7 @@ def browse(service_type=DEFAULT_SERVICE_TYPE, timeout=3.0): Unlike :func:`discover`, which connects to the first match, this collects every service seen within ``timeout`` and returns their addresses *without* - connecting, so a caller (or ``mytk-remote --browse``) can show what is + connecting, so a caller (or ``mytk --browse``) can show what is running:: for server in mytk.browse(): diff --git a/mytk/remotecli.py b/mytk/remotecli.py index b27f725..54bd42b 100644 --- a/mytk/remotecli.py +++ b/mytk/remotecli.py @@ -3,19 +3,19 @@ Send a single call to a running app that exposed functions with :class:`~mytk.remotecontrollable.RemoteControllable` and print the result:: - python -m mytk --remote "turn_on()" + mytk "add(2, 3)" # the `mytk` console script + mytk --app-name Acquisition "status()" + mytk --list # show the exposed functions + python -m mytk --remote "turn_on()" # equivalent module form python -m mytk --remote "set_power(2.5)" --port 9000 - mytk-remote "add(2, 3)" # standalone console script - mytk-remote --app-name Acquisition "status()" - mytk-remote --list # show the exposed functions -Instead of a fixed ``--host``/``--port``, the server can be located on the -local network via mDNS/Bonjour (as published by ``advertise_remote``):: +Instead of a fixed ``--host``/``--port``, the server can be located on the local +network via mDNS/Bonjour (as published by ``advertise_remote``):: - mytk-remote --discover "turn_on()" - mytk-remote --discover --app-name Microscope "status()" - mytk-remote --discover --list - mytk-remote --browse # list all apps on the network + mytk --discover "turn_on()" + mytk --discover --app-name Microscope "status()" + mytk --discover --list + mytk --browse # list all apps on the network Arguments in the call string must be Python literals (numbers, strings, True/False/None, lists, dicts, tuples); a bare ``"turn_on"`` is treated as @@ -195,8 +195,8 @@ def run(argv=None, prog=None): def main(): - """Console-script entry point (``mytk-remote``).""" - raise SystemExit(run(prog="mytk-remote")) + """Console-script entry point for the ``mytk`` command.""" + raise SystemExit(run(prog="mytk")) if __name__ == "__main__": diff --git a/mytk/remotecontrollable.py b/mytk/remotecontrollable.py index ce61e5c..34d6719 100644 --- a/mytk/remotecontrollable.py +++ b/mytk/remotecontrollable.py @@ -21,7 +21,7 @@ def read_status(self): app.mainloop() Clients connect with ``mytk.connect(...)`` or ``mytk.remote_app`` (see -:mod:`mytk.remote`), or from the command line with ``mytk-remote`` / +:mod:`mytk.remote`), or from the command line with the ``mytk`` command / ``python -m mytk --remote`` (see :mod:`mytk.remotecli`). The transport is stdlib XML-RPC, so arguments and return values must be XML-RPC serializable (numbers, str, bool, None, list, dict). @@ -218,7 +218,7 @@ def start_remote(self, port=8777, host="127.0.0.1", app_name=None): self.remote_server = server thread = threading.Thread( - target=server.serve_forever, name="mytk-remote", daemon=True + target=server.serve_forever, name="mytk-server", daemon=True ) thread.start() diff --git a/mytk/tests/testRemoteDiscovery.py b/mytk/tests/testRemoteDiscovery.py index 4e01cd0..383f9a4 100644 --- a/mytk/tests/testRemoteDiscovery.py +++ b/mytk/tests/testRemoteDiscovery.py @@ -190,7 +190,7 @@ def test_browse_without_zeroconf_raises_importerror(self): class TestRemoteCLIDiscovery(unittest.TestCase): - """`mytk-remote --discover` wiring, with discover() itself stubbed out.""" + """`mytk --discover` wiring, with discover() itself stubbed out.""" class FakeProxy: def remote_signatures(self): @@ -203,7 +203,7 @@ def _run(self, argv): out = io.StringIO() err = io.StringIO() with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err): - code = run(argv, prog="mytk-remote") + code = run(argv, prog="mytk") return code, out.getvalue(), err.getvalue() def test_discover_list(self): diff --git a/pyproject.toml b/pyproject.toml index 4050949..8219075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ classifiers = [ ] [project.scripts] -mytk-remote = "mytk.remotecli:main" +mytk = "mytk.remotecli:main" [project.urls] Homepage = "https://github.com/DCC-Lab/myTk"