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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions synapse/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from rich.logging import RichHandler

from synapse.cli import (
build,
deploy,
apps,
discover,
files,
offline_plot,
Expand Down Expand Up @@ -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()

Expand Down
58 changes: 58 additions & 0 deletions synapse/cli/apps.py
Original file line number Diff line number Diff line change
@@ -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)
30 changes: 2 additions & 28 deletions synapse/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -542,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)
18 changes: 0 additions & 18 deletions synapse/cli/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 0 additions & 3 deletions synapse/cli/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down