From ee52be2917a20cc1e7650d7c9fc06e40bd32ef57 Mon Sep 17 00:00:00 2001 From: Max Hodak Date: Sun, 11 Jan 2026 13:33:32 -0800 Subject: [PATCH 1/2] Add ListApps support to Python client - Add list_apps() method to Device class - Add 'list-apps' CLI command to synapsectl - Fix setup.sh to use python3 for proto generation Usage: synapsectl list-apps Programmatic: device = syn.Device("192.168.1.100:647") apps = device.list_apps() --- setup.sh | 2 +- synapse-api | 2 +- synapse/cli/rpc.py | 23 +++++++++++++++++++++++ synapse/client/device.py | 13 +++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 5421239..0d586bc 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Define variables -PROTOC="python -m grpc_tools.protoc" +PROTOC="python3 -m grpc_tools.protoc" PROTO_DIR_SYNAPSE_API="./synapse-api" PROTO_OUT_SYNAPSE_API="./synapse" diff --git a/synapse-api b/synapse-api index 5c048bc..8ef20af 160000 --- a/synapse-api +++ b/synapse-api @@ -1 +1 @@ -Subproject commit 5c048bcb458ef0dc52411089b00223db8d75338c +Subproject commit 8ef20afdb648da8e76b7da8518b51c9a28aa6e6a diff --git a/synapse/cli/rpc.py b/synapse/cli/rpc.py index ec751e9..1191ed2 100644 --- a/synapse/cli/rpc.py +++ b/synapse/cli/rpc.py @@ -97,6 +97,9 @@ def add_commands(subparsers): ) f.set_defaults(func=get_logs) + g = subparsers.add_parser("list-apps", help="List installed applications on the device") + g.set_defaults(func=list_apps) + def info(args): device = syn.Device(args.uri, args.verbose) @@ -338,3 +341,23 @@ def parse_datetime(time_str: Optional[str]) -> Optional[datetime]: finally: if output_file: output_file.close() + + +def list_apps(args): + console = Console() + with console.status("Listing installed applications...", spinner="bouncingBall"): + device = syn.Device(args.uri, args.verbose) + response = device.list_apps() + + if not response: + console.print("[bold red]Failed to list applications") + return + + if not response.apps: + console.print("[yellow]No applications installed on the device") + return + + console.print("[bold]Installed Applications:[/bold]") + for app in response.apps: + version_str = f" (v{app.version})" if app.version else "" + console.print(f" • {app.name}{version_str}") diff --git a/synapse/client/device.py b/synapse/client/device.py index 4d9e442..2350f7b 100644 --- a/synapse/client/device.py +++ b/synapse/client/device.py @@ -18,6 +18,10 @@ UpdateDeviceSettingsRequest, UpdateDeviceSettingsResponse, ) +from synapse.api.app_pb2 import ( + ListAppsRequest, + ListAppsResponse, +) from synapse.client.config import Config from synapse.utils.log import log_level_to_pb @@ -197,6 +201,15 @@ def update_device_settings( self.logger.error(f"Error during update settings: {str(e)}") return None + def list_apps(self) -> Optional[ListAppsResponse]: + """List installed applications on the device.""" + try: + response = self.rpc.ListApps(ListAppsRequest()) + return response + except grpc.RpcError as e: + self.logger.error("Error listing apps: %s", e.details()) + return None + def _handle_status_response(self, status): if status.code != StatusCode.kOk: self.logger.error("Error %d: %s", status.code, status.message) From e411cda098dc44b9bb806626c54e73c6c9a7286a Mon Sep 17 00:00:00 2001 From: Max Hodak Date: Sun, 11 Jan 2026 13:49:55 -0800 Subject: [PATCH 2/2] Revert setup.sh back to python Revert the PROTOC command from python3 to python per reviewer feedback. --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 0d586bc..5421239 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Define variables -PROTOC="python3 -m grpc_tools.protoc" +PROTOC="python -m grpc_tools.protoc" PROTO_DIR_SYNAPSE_API="./synapse-api" PROTO_OUT_SYNAPSE_API="./synapse"