Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mytk/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
24 changes: 12 additions & 12 deletions mytk/remotecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__":
Expand Down
4 changes: 2 additions & 2 deletions mytk/remotecontrollable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions mytk/tests/testRemoteDiscovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading