dp3.bin.shcmd.common ¶
Shared helpers for the shell-oriented DP3 CLI.
APIError ¶
Bases: RuntimeError
Raised when an API request fails.
DP3APIClient ¶
DP3APIClient(config_dir: str, base_url: Optional[str] = None, timeout: float = 5.0, model_spec: Optional[ModelSpec] = None)
Small HTTP client for the DP3 API.
Source code in dp3/bin/shcmd/common.py
read_json_value ¶
Decode a JSON literal from a command-line argument.
read_json_input ¶
Decode JSON from a file path or standard input.
Source code in dp3/bin/shcmd/common.py
print_response_json ¶
Write an API JSON response to standard output.
common_time_params ¶
Build shared time-range query parameters from parsed arguments.
Source code in dp3/bin/shcmd/common.py
read_json_object ¶
Decode a JSON object from a command-line argument.
Source code in dp3/bin/shcmd/common.py
stream_json_pages ¶
stream_json_pages(client: DP3APIClient, path: str, params: dict[str, Any], start_skip: int, requested_limit: int, page_size: int = 100) -> int
Stream paged JSON API results as NDJSON.
Source code in dp3/bin/shcmd/common.py
resolve_config_dir ¶
Resolve the configuration directory for the shell-oriented CLI.
Source code in dp3/bin/shcmd/common.py
load_completion_model_spec
cached
¶
Load the model specification used by shell completion.
Source code in dp3/bin/shcmd/common.py
load_completion_entity_catalog
cached
¶
load_completion_entity_catalog(config_dir: str, base_url: Optional[str], timeout: float) -> Optional[dict[str, Any]]
Load entity metadata from the API when config-based completion is unavailable.
Source code in dp3/bin/shcmd/common.py
get_completion_context ¶
Return completion metadata derived from config and API sources.
Source code in dp3/bin/shcmd/common.py
complete_entity_type_names ¶
Complete entity type names from config or API metadata.