qapu-cli 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qapu-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm.
5
5
  Author: OVOO Technology
6
6
  Classifier: Programming Language :: Python :: 3
@@ -49,6 +49,7 @@ Either way installs a `qapu` command (see `pyproject.toml`'s `[project.scripts]`
49
49
  ## Commands
50
50
 
51
51
  ```bash
52
+ qapu --version # print the installed qapu-cli version and exit
52
53
  qapu health # GET /health - no auth, quick connectivity check
53
54
  qapu device list # GET /hermes/devices - every device, bulk, as a table
54
55
  qapu device list --json # same data, raw JSON
@@ -37,6 +37,7 @@ Either way installs a `qapu` command (see `pyproject.toml`'s `[project.scripts]`
37
37
  ## Commands
38
38
 
39
39
  ```bash
40
+ qapu --version # print the installed qapu-cli version and exit
40
41
  qapu health # GET /health - no auth, quick connectivity check
41
42
  qapu device list # GET /hermes/devices - every device, bulk, as a table
42
43
  qapu device list --json # same data, raw JSON
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qapu-cli"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -5,6 +5,7 @@
5
5
 
6
6
  import json
7
7
  from datetime import datetime, timezone
8
+ from importlib.metadata import PackageNotFoundError, version as _package_version
8
9
  from typing import Any, Optional
9
10
 
10
11
  import httpx
@@ -22,6 +23,33 @@ app.add_typer(variable_app, name="variable")
22
23
 
23
24
  console = Console()
24
25
 
26
+
27
+ # --version - Reads the Installed Package Metadata Directly, so it's
28
+ # Always in Sync with pyproject.toml's version - Nothing to Hand-Bump Here.
29
+ def _version_callback(show_version: bool) -> None:
30
+
31
+ # Only Act if --version was Actually Passed
32
+ if not show_version:
33
+ return
34
+
35
+ # Try to Resolve the Installed Version
36
+ try:
37
+ typer.echo(_package_version("qapu-cli"))
38
+
39
+ # Not Installed as a Package (e.g. Running Straight from Source)
40
+ except PackageNotFoundError:
41
+ typer.echo("unknown (not installed as a package)")
42
+
43
+ # Exit Before Typer Falls Through to "No Command Given" Help Text
44
+ raise typer.Exit()
45
+
46
+
47
+ @app.callback()
48
+ def _root(
49
+ version: Optional[bool] = typer.Option(None, "--version", callback=_version_callback, is_eager=True, help="Show the installed qapu-cli version and exit."),
50
+ ) -> None:
51
+ """Qapu API client CLI."""
52
+
25
53
  # Segment Name -> ID, Matching Constants.Variable_Segment (common/qapu_common/constants.py)
26
54
  SEGMENTS = {
27
55
  "unknown": 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qapu-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm.
5
5
  Author: OVOO Technology
6
6
  Classifier: Programming Language :: Python :: 3
@@ -49,6 +49,7 @@ Either way installs a `qapu` command (see `pyproject.toml`'s `[project.scripts]`
49
49
  ## Commands
50
50
 
51
51
  ```bash
52
+ qapu --version # print the installed qapu-cli version and exit
52
53
  qapu health # GET /health - no auth, quick connectivity check
53
54
  qapu device list # GET /hermes/devices - every device, bulk, as a table
54
55
  qapu device list --json # same data, raw JSON
File without changes
File without changes
File without changes