ann_router.cli_click module

click command-line interface — the optional, ergonomic CLI twin.

Identical behaviour to ann_router.cli_argparse, but built on click for a nicer help/UX. click is an optional dependency (pip install 'ann-router[cli]'): the argparse CLI is the always-available one, so importing this module lazily requires click and fails with an actionable message if it is missing. Every command delegates to the shared ann_router._core_cli, so the two CLIs can never drift apart.

Consumes: click (optional), ann_router._core_cli, os_helper. Produces: main() (the ann-router-click console-script entry point, wrapping cli()).

Author: Warith Harchaoui <warith.harchaoui@deraison.ai>

ann_router.cli_click.capabilities_cmd()

List backends, availability and capabilities.

Return type:

None

ann_router.cli_click.main()[source]

Console entry point (ann-router-click).

click’s own dispatch only special-cases ClickException/Abort (and a broken pipe); a plain library exception (e.g. Criteria.validate()’s ValueError) would otherwise propagate as a raw Python traceback instead of a clean CLI error. This wraps the whole invocation and translates that last case into a one-line stderr message + exit 1 – click’s own control flow (usage errors, --help, an explicit sys.exit in a subcommand) already raises SystemExit, a BaseException this does not catch, so it passes through untouched.

Return type:

None