ann_router.cli_argparse module

argparse command-line interface — the always-available CLI door.

This is the second of ann-router’s five surfaces (after the library) and, like os-helper’s cli_argparse, it needs no third-party dependency: argparse ships with Python, so ann-router works the moment the package is installed. Every subcommand is a thin shell over ann_router._core_cli; the click twin (ann-router-click) drives the exact same core.

Subcommands: route, build, search, bench, capabilities.

Consumes: ann_router._core_cli, os_helper (logging to stderr). Produces: main() (the ann-router console-script entry point).

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

ann_router.cli_argparse.build_parser()[source]

Construct the full argument parser with every subcommand.

Returns:

The configured parser (used by main() and by the tests).

Return type:

argparse.ArgumentParser

Examples

>>> parser = build_parser()
>>> ns = parser.parse_args(["route", "--n-vectors", "500", "--dim", "16"])
>>> ns.command
'route'
ann_router.cli_argparse.main(argv=None)[source]

Entry point for the ann-router console script.

Parameters:

argv (list of str, optional) – Argument vector (defaults to sys.argv[1:]).

Returns:

Process exit code (0 on success).

Return type:

int

Examples

>>> main(["route", "--n-vectors", "500", "--dim", "16"])
0