xoople-cli 0.6.0__tar.gz → 0.7.0__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.
Files changed (26) hide show
  1. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/PKG-INFO +18 -8
  2. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/README.md +16 -6
  3. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/pyproject.toml +2 -2
  4. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/pyproject.toml.orig +2 -2
  5. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_context.py +2 -2
  6. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_errors.py +10 -0
  7. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/auth.py +2 -2
  8. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/main.py +2 -1
  9. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/outputs.py +5 -0
  10. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/usage.py +15 -1
  11. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/LICENSE +0 -0
  12. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/__init__.py +0 -0
  13. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/__main__.py +0 -0
  14. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_ciam.py +0 -0
  15. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_output.py +0 -0
  16. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_spec.py +0 -0
  17. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/_version.py +0 -0
  18. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/access.py +0 -0
  19. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/analyses.py +0 -0
  20. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/catalog.py +0 -0
  21. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/events.py +0 -0
  22. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/packages.py +0 -0
  23. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/projects.py +0 -0
  24. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/questions.py +0 -0
  25. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/runs.py +0 -0
  26. {xoople_cli-0.6.0 → xoople_cli-0.7.0}/src/xoople/cli/schedules.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xoople-cli
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Command-line interface for the Xoople Products API.
5
5
  License-Expression: LicenseRef-Xoople-Proprietary
6
6
  License-File: LICENSE
7
7
  Classifier: Development Status :: 3 - Alpha
8
8
  Classifier: Programming Language :: Python :: 3.12
9
- Requires-Dist: xoople-sdk>=0.8.0
9
+ Requires-Dist: xoople-sdk>=0.10.0
10
10
  Requires-Dist: cyclopts>=4.18,<5
11
11
  Requires-Dist: rich>=13.7
12
12
  Requires-Python: >=3.12
@@ -24,24 +24,34 @@ $ xoople analyses list
24
24
  ```
25
25
 
26
26
  Every command reads `--api-url` and `--token` from `XOOPLE_API_URL` and
27
- `XOOPLE_TOKEN`. `--json` prints the API response verbatim instead of a table, so
28
- output pipes into `jq`.
27
+ `XOOPLE_TOKEN`. `--json` prints the response as the SDK parses it instead of a
28
+ table, so output pipes into `jq`. Every field the SDK model declares appears, and
29
+ one the API leaves out uses the SDK model's default, which may be `null`. A field
30
+ the API sends but this SDK version does not declare is dropped.
29
31
 
30
32
  ## Commands
31
33
 
32
34
  | Group | Commands |
33
35
  | --- | --- |
34
- | `analyses` | `list` `get` `create` `update` `cancel` `delete` `estimate` |
36
+ | `analyses` | `list` `get` `status` `create` `update` `cancel` `delete` `run-again` `estimate-run-again` `estimate` |
37
+ | `projects` | `list` `create` `get` `update` `members` `add-member` `remove-member` `move` `archive` `delete` `record-access` `recent` |
35
38
  | `runs` | `list` `get` |
36
- | `outputs` | `list` `get` `access-url` |
39
+ | `outputs` | `list` `get` `access-url` `summary` `preview` `refresh-summary` |
40
+ | `packages` | `create` `list` `get` `access-url` `delete` |
37
41
  | `schedules` | `list` `get` `create` `pause` `resume` `cancel` `run` `estimate-run` |
38
42
  | `events` | `list` `get` |
39
43
  | `usage` | `history` `limits` |
40
- | `catalog` | `products` `measures` `designs` |
44
+ | `catalog` | `products` `measures` `projections` `cloud-mask-presets` `designs` |
41
45
  | `questions` | `list` `show` `ask` |
42
- | `access` | `me` `token` `features` |
46
+ | `access` | `me` `token` `rotate-token` `features` |
43
47
  | `auth` | `login` `logout` `status` |
44
48
 
49
+ `outputs access-url` works only for a product that declares the
50
+ `outputs.download` capability, which is Imagery Time Series today. On a tabular
51
+ output the API answers 422 `unsupported_operation` and the CLI exits `6`. Read
52
+ tabular rows over Delta Sharing (`access token`), or export a Tabular Time Series
53
+ analysis with `packages create`.
54
+
45
55
  ## Signing in
46
56
 
47
57
  `auth login` signs in through the browser with PKCE and stores the session at
@@ -9,24 +9,34 @@ $ xoople analyses list
9
9
  ```
10
10
 
11
11
  Every command reads `--api-url` and `--token` from `XOOPLE_API_URL` and
12
- `XOOPLE_TOKEN`. `--json` prints the API response verbatim instead of a table, so
13
- output pipes into `jq`.
12
+ `XOOPLE_TOKEN`. `--json` prints the response as the SDK parses it instead of a
13
+ table, so output pipes into `jq`. Every field the SDK model declares appears, and
14
+ one the API leaves out uses the SDK model's default, which may be `null`. A field
15
+ the API sends but this SDK version does not declare is dropped.
14
16
 
15
17
  ## Commands
16
18
 
17
19
  | Group | Commands |
18
20
  | --- | --- |
19
- | `analyses` | `list` `get` `create` `update` `cancel` `delete` `estimate` |
21
+ | `analyses` | `list` `get` `status` `create` `update` `cancel` `delete` `run-again` `estimate-run-again` `estimate` |
22
+ | `projects` | `list` `create` `get` `update` `members` `add-member` `remove-member` `move` `archive` `delete` `record-access` `recent` |
20
23
  | `runs` | `list` `get` |
21
- | `outputs` | `list` `get` `access-url` |
24
+ | `outputs` | `list` `get` `access-url` `summary` `preview` `refresh-summary` |
25
+ | `packages` | `create` `list` `get` `access-url` `delete` |
22
26
  | `schedules` | `list` `get` `create` `pause` `resume` `cancel` `run` `estimate-run` |
23
27
  | `events` | `list` `get` |
24
28
  | `usage` | `history` `limits` |
25
- | `catalog` | `products` `measures` `designs` |
29
+ | `catalog` | `products` `measures` `projections` `cloud-mask-presets` `designs` |
26
30
  | `questions` | `list` `show` `ask` |
27
- | `access` | `me` `token` `features` |
31
+ | `access` | `me` `token` `rotate-token` `features` |
28
32
  | `auth` | `login` `logout` `status` |
29
33
 
34
+ `outputs access-url` works only for a product that declares the
35
+ `outputs.download` capability, which is Imagery Time Series today. On a tabular
36
+ output the API answers 422 `unsupported_operation` and the CLI exits `6`. Read
37
+ tabular rows over Delta Sharing (`access token`), or export a Tabular Time Series
38
+ analysis with `packages create`.
39
+
30
40
  ## Signing in
31
41
 
32
42
  `auth login` signs in through the browser with PKCE and stores the session at
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xoople-cli"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "Command-line interface for the Xoople Products API."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -11,7 +11,7 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.12",
12
12
  ]
13
13
  dependencies = [
14
- "xoople-sdk>=0.8.0",
14
+ "xoople-sdk>=0.10.0",
15
15
  "cyclopts>=4.18,<5",
16
16
  "rich>=13.7",
17
17
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xoople-cli"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "Command-line interface for the Xoople Products API."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -13,7 +13,7 @@ classifiers = [
13
13
  "Programming Language :: Python :: 3.12",
14
14
  ]
15
15
  dependencies = [
16
- "xoople-sdk>=0.8.0",
16
+ "xoople-sdk>=0.10.0",
17
17
  # Cyclopts parses docstrings for parameter help so signatures stay plain,
18
18
  # supports union types and Pydantic models natively, and owns its parser.
19
19
  # Global options + dependency injection go through the meta-app launcher
@@ -4,7 +4,7 @@ from typing import Annotated, Protocol
4
4
 
5
5
  from cyclopts import Parameter
6
6
  from xoople.cli import _ciam
7
- from xoople.cli._errors import UsageError
7
+ from xoople.cli._errors import NotSignedIn, UsageError
8
8
  from xoople.cli._version import version as cli_version
9
9
  from xoople.sdk import Config, CredentialProvider, XoopleClient
10
10
  from xoople.sdk import session as session_file
@@ -91,7 +91,7 @@ def _credential_provider(credentials: Credentials) -> CredentialProvider:
91
91
  # The credential refreshes a user token itself. Store what it mints, so
92
92
  # the next run does not spend another refresh token.
93
93
  return CiamUserCredentials(session, on_refresh=_persist_session)
94
- raise UsageError("no credentials: run `xoople auth login`, pass --token, or set XOOPLE_TOKEN")
94
+ raise NotSignedIn("no credentials: run `xoople auth login`, pass --token, or set XOOPLE_TOKEN")
95
95
 
96
96
 
97
97
  def build_client(credentials: Credentials) -> XoopleClient:
@@ -48,6 +48,16 @@ class LoginFailed(CliError):
48
48
  exit_code = EXIT_CODES[errors.AuthenticationError]
49
49
 
50
50
 
51
+ class NotSignedIn(CliError):
52
+ """A command needs a credential and there is none to send.
53
+
54
+ Takes the API's unauthenticated code, like `LoginFailed`, so a script tests
55
+ one number for "sign in first".
56
+ """
57
+
58
+ exit_code = EXIT_CODES[errors.AuthenticationError]
59
+
60
+
51
61
  class RunFailed(CliError):
52
62
  """``--wait`` finished, but the run ended in a non-``COMPLETE`` state."""
53
63
 
@@ -2,7 +2,7 @@ from cyclopts import App
2
2
  from pydantic import BaseModel
3
3
  from xoople.cli import _ciam
4
4
  from xoople.cli._context import SettingsParam
5
- from xoople.cli._errors import LoginFailed
5
+ from xoople.cli._errors import LoginFailed, NotSignedIn
6
6
  from xoople.cli._output import emit_one, note
7
7
  from xoople.sdk import session as session_file
8
8
  from xoople.sdk.auth import normalize_api_url
@@ -65,6 +65,6 @@ def status(*, settings: SettingsParam) -> None:
65
65
  """Show who the stored session belongs to, and when it expires."""
66
66
  session = session_file.read_session()
67
67
  if session is None:
68
- raise LoginFailed("no stored session: run `xoople auth login`")
68
+ raise NotSignedIn("no stored session: run `xoople auth login`")
69
69
  row = _StatusRow(email=session.email, org_id=session.org_id, expires_at=session.expires_at)
70
70
  emit_one(row, FIELDS, as_json=settings.as_json)
@@ -93,7 +93,8 @@ def create_app(
93
93
  max_retries:
94
94
  Retries for replay-safe requests on 429 and 5xx.
95
95
  json_output:
96
- Print the raw API response instead of a table.
96
+ Print the response as the SDK parses it instead of a table.
97
+ Missing fields use the SDK model's default, which may be null.
97
98
  """
98
99
  if not tokens:
99
100
  # Bare invocation prints help rather than erroring — a deliberate
@@ -62,6 +62,11 @@ def access_url(
62
62
  ) -> None:
63
63
  """Mint a time-limited download URL for an output.
64
64
 
65
+ Only products that declare the `outputs.download` capability support this,
66
+ which is Imagery Time Series today. A tabular output answers 422
67
+ `unsupported_operation` (exit 6); read it over Delta Sharing (`access token`)
68
+ or export a Tabular Time Series one with `packages create`.
69
+
65
70
  Parameters
66
71
  ----------
67
72
  analysis:
@@ -27,6 +27,13 @@ PRODUCT_COLUMNS = [
27
27
  ("LABEL", "unit_label"),
28
28
  ]
29
29
 
30
+ METER_LIMIT_COLUMNS = [
31
+ ("METER", "meter"),
32
+ ("COUNTS", "label"),
33
+ ("USED", "used"),
34
+ ("MONTHLY LIMIT", "cap"),
35
+ ]
36
+
30
37
  WINDOW_COLUMNS = [
31
38
  ("DIMENSION", "dimension"),
32
39
  ("LIMIT", "limit"),
@@ -84,7 +91,11 @@ def history(
84
91
 
85
92
  @app.command(name="limits")
86
93
  def limits(*, settings: SettingsParam) -> None:
87
- """Show current-period consumption, and the quota windows in force for each product."""
94
+ """Show current-period consumption, quota windows and monthly limits.
95
+
96
+ Quota windows are the ones in force for each product. The monthly limits are the
97
+ caps on costly routes, such as place search, and appear for an organization read only.
98
+ """
88
99
  result = settings.client().usage.limits()
89
100
  if settings.as_json:
90
101
  emit_model(result, as_json=True)
@@ -97,3 +108,6 @@ def limits(*, settings: SettingsParam) -> None:
97
108
  continue
98
109
  heading(f"{summary.product} quota")
99
110
  emit(summary.quota_status.windows, WINDOW_COLUMNS, as_json=False)
111
+ if result.meter_limits:
112
+ heading("monthly limits")
113
+ emit(result.meter_limits, METER_LIMIT_COLUMNS, as_json=False)
File without changes