From fc97b701d0cce94139d9aa9f2531508e1f96487b Mon Sep 17 00:00:00 2001 From: Max Hodak Date: Sun, 11 Jan 2026 22:22:51 -0800 Subject: [PATCH 1/2] Add category flag to nfpm packaging Sets the package category to synapse-apps for better organization. --- synapse/cli/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/synapse/cli/build.py b/synapse/cli/build.py index 00803db..8dfda73 100644 --- a/synapse/cli/build.py +++ b/synapse/cli/build.py @@ -401,6 +401,8 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo "Synapse Application", "--architecture", "arm64", + "--category", + "synapse-apps", ] # Attach lifecycle scripts From d18af4f7d9876e0c437c445db66a2cbdac5d2df0 Mon Sep 17 00:00:00 2001 From: Max Hodak Date: Sun, 11 Jan 2026 22:36:42 -0800 Subject: [PATCH 2/2] Add apps command group to CLI Reorganizes app-related commands under `synapsectl apps`: - synapsectl apps build - synapsectl apps deploy - synapsectl apps list Bumps version to 2.4.0. --- setup.py | 2 +- synapse/cli/__main__.py | 6 ++--- synapse/cli/apps.py | 58 +++++++++++++++++++++++++++++++++++++++++ synapse/cli/build.py | 28 -------------------- synapse/cli/deploy.py | 18 ------------- synapse/cli/rpc.py | 3 --- 6 files changed, 61 insertions(+), 54 deletions(-) create mode 100644 synapse/cli/apps.py diff --git a/setup.py b/setup.py index 33e8bcb..a2598dd 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup( name="science-synapse", - version="2.3.4", + version="2.4.0", description="Client library and CLI for the Synapse API", author="Science Team", author_email="team@science.xyz", diff --git a/synapse/cli/__main__.py b/synapse/cli/__main__.py index 965f5a1..af66f34 100755 --- a/synapse/cli/__main__.py +++ b/synapse/cli/__main__.py @@ -9,8 +9,7 @@ from rich.logging import RichHandler from synapse.cli import ( - build, - deploy, + apps, discover, files, offline_plot, @@ -76,8 +75,7 @@ def main(): offline_plot.add_commands(subparsers) files.add_commands(subparsers) taps.add_commands(subparsers) - deploy.add_commands(subparsers) - build.add_commands(subparsers) + apps.add_commands(subparsers) settings.add_commands(subparsers) args = parser.parse_args() diff --git a/synapse/cli/apps.py b/synapse/cli/apps.py new file mode 100644 index 0000000..04b86b6 --- /dev/null +++ b/synapse/cli/apps.py @@ -0,0 +1,58 @@ +"""CLI commands for managing Synapse applications.""" + +from synapse.cli.build import build_cmd +from synapse.cli.deploy import deploy_cmd +from synapse.cli.rpc import list_apps + + +def add_commands(subparsers): + """Add the apps command group to the CLI.""" + apps_parser = subparsers.add_parser("apps", help="Manage applications on a Synapse device") + apps_subparsers = apps_parser.add_subparsers(title="App Commands") + + # build subcommand + build_parser = apps_subparsers.add_parser( + "build", + help="Cross-compile and package an application into a .deb without deploying", + ) + build_parser.add_argument( + "app_dir", + nargs="?", + default=".", + help="Path to the application directory (defaults to current working directory)", + ) + build_parser.add_argument( + "--skip-build", + action="store_true", + default=False, + help="Skip compilation phase; assume the binary already exists and only build the .deb package.", + ) + build_parser.add_argument( + "--clean", + action="store_true", + default=False, + help="Clean build directories and force a complete rebuild from scratch.", + ) + build_parser.set_defaults(func=build_cmd) + + # deploy subcommand + deploy_parser = apps_subparsers.add_parser( + "deploy", help="Deploy an application to a Synapse device" + ) + deploy_parser.add_argument( + "app_dir", nargs="?", default=".", help="Path to the application directory" + ) + deploy_parser.add_argument( + "--package", + "-p", + help="Path to a pre-built .deb to deploy (skips local build and package steps)", + type=str, + default=None, + ) + deploy_parser.set_defaults(func=deploy_cmd) + + # list subcommand + list_parser = apps_subparsers.add_parser( + "list", help="List installed applications on the device" + ) + list_parser.set_defaults(func=list_apps) diff --git a/synapse/cli/build.py b/synapse/cli/build.py index 8dfda73..a76fb8c 100644 --- a/synapse/cli/build.py +++ b/synapse/cli/build.py @@ -544,31 +544,3 @@ def build_cmd(args) -> None: box=box.DOUBLE, ) ) - - -def add_commands(subparsers) -> None: - """Register the *build* command with the top-level CLI parser.""" - - build_parser = subparsers.add_parser( - "build", - help="Cross-compile and package an application into a .deb without deploying", - ) - build_parser.add_argument( - "app_dir", - nargs="?", - default=".", - help="Path to the application directory (defaults to current working directory)", - ) - build_parser.add_argument( - "--skip-build", - action="store_true", - default=False, - help="Skip compilation phase; assume the binary already exists and only build the .deb package.", - ) - build_parser.add_argument( - "--clean", - action="store_true", - default=False, - help="Clean build directories and force a complete rebuild from scratch.", - ) - build_parser.set_defaults(func=build_cmd) diff --git a/synapse/cli/deploy.py b/synapse/cli/deploy.py index 5614d22..2652557 100644 --- a/synapse/cli/deploy.py +++ b/synapse/cli/deploy.py @@ -260,21 +260,3 @@ def deploy_cmd(args): "[yellow]No URI provided. Package created but not deployed.[/yellow]" ) console.print(f"[green]Package available at:[/green] {deb_package}") - - -def add_commands(subparsers): - """Add deploy commands to the CLI""" - deploy_parser = subparsers.add_parser( - "deploy", help="Deploy an application to a Synapse device" - ) - deploy_parser.add_argument( - "app_dir", nargs="?", default=".", help="Path to the application directory" - ) - deploy_parser.add_argument( - "--package", - "-p", - help="Path to a pre-built .deb to deploy (skips local build and package steps)", - type=str, - default=None, - ) - deploy_parser.set_defaults(func=deploy_cmd) diff --git a/synapse/cli/rpc.py b/synapse/cli/rpc.py index 1191ed2..678e95b 100644 --- a/synapse/cli/rpc.py +++ b/synapse/cli/rpc.py @@ -97,9 +97,6 @@ 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)