Skip to main content

sonnet-cli

Typer and rich building blocks for the command-line side of a sonnet-server application: a base app, a database command group, a resource command factory and terminal widgets.

It is a library, not a binary. There is no [project.scripts] entry and no sonnet-cli command; installing it puts nothing on your PATH. Your application defines its own Typer app and its own entry point, and mounts these pieces into it.

Version 0.2.0.

What it provides

  • sonnet_cli.commands.db -- a db check / db upgrade group that runs against the application's own Alembic chain.
  • sonnet_cli.resource_cli -- uniform list / get / set commands over a ResourceSpec-backed resource, talking to the repository directly with no HTTP server involved.
  • sonnet_cli.checks -- a readiness-pipeline runner and the database pipeline builders behind the db commands.
  • sonnet_cli.multiselect -- an arrow-key checkbox picker with a numbered fallback when stdin is not a TTY.
  • sonnet_cli.utils -- the shared rich console and path helpers that exit cleanly.
  • sonnet_cli.app -- a ready-made base Typer app with the db group mounted, for cases where you do not need your own callback.

python -m sonnet_cli db check exists so the commands can be exercised in-tree during development. It is not an operator interface.

Install

uv add sonnet-cli

Depends on typer, rich, sonnet-server and sonnet-core. Adding it to an application that already depends on sonnet-server costs two terminal libraries and nothing else. The only extra is dev.

Usage

Define your own Typer app, register your services in the callback, and mount the groups you want:

import typer
from sonnet_cli.commands import db
from sonnet_core.services.registry import get_service_registry

from example_server.services.di import register_all_services

app = typer.Typer(name="example-server-cli", no_args_is_help=True)


@app.callback()
def main_callback() -> None:
    registry = get_service_registry()
    register_all_services(registry)


app.add_typer(db.app, name="db")

Your [project.scripts] entry points at that app. The commands still need settings loaded and services registered before they run -- that bootstrap is your application's job, and the usage guides walk through it.

Documentation

License

Apache 2.0 -- see LICENSE.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sonnet_cli-0.2.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sonnet_cli-0.2.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file sonnet_cli-0.2.1.tar.gz.

File metadata

  • Download URL: sonnet_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sonnet_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 baac4dfd45ec78e0ed40f4058c6ad0e57170a4a62a1b605d8a5ae3cbe691a108
MD5 2627828c97434dfc4f6ff723b29b3996
BLAKE2b-256 f2002117ff9051d2d6dce415a733236c97c107613f5cfc54cf744cb47e4439c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for sonnet_cli-0.2.1.tar.gz:

Publisher: publish.yml on petrarca/sonnet-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sonnet_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sonnet_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sonnet_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 722bc27794ec592d6ac343ed23239704e4ffbad344f6f86ea9d34a5ed19e4cdc
MD5 2b4b5c8d66f96dc4ad62b822db5bf78a
BLAKE2b-256 6f060f98ab3e6d2eedb829304d89ae963313eecf35f9078cd709db5a98e963b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sonnet_cli-0.2.1-py3-none-any.whl:

Publisher: publish.yml on petrarca/sonnet-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page