sference-cli 0.5.0__tar.gz → 0.5.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.5
2
2
  Name: sference-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: sference command-line interface
5
5
  Project-URL: Homepage, https://sference.com
6
6
  Project-URL: Repository, https://github.com/s-ference/sference
@@ -15,13 +15,13 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python :: 3
17
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
22
  Classifier: Topic :: Utilities
23
- Requires-Python: >=3.10
24
- Requires-Dist: sference-sdk>=0.3.2
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: sference-sdk>=0.4.0
25
25
  Requires-Dist: typer>=0.24.1
26
26
  Description-Content-Type: text/markdown
27
27
 
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "sference-cli"
3
- version = "0.5.0"
3
+ version = "0.5.1"
4
4
  description = "sference command-line interface"
5
5
  readme = "README.md"
6
- requires-python = ">=3.10"
6
+ requires-python = ">=3.11"
7
7
  license = "Apache-2.0"
8
8
  license-files = ["LICENSE"]
9
9
  authors = [{ name = "sference" }]
@@ -15,15 +15,15 @@ classifiers = [
15
15
  "Operating System :: OS Independent",
16
16
  "Programming Language :: Python :: 3",
17
17
  "Programming Language :: Python :: 3 :: Only",
18
- "Programming Language :: Python :: 3.10",
19
18
  "Programming Language :: Python :: 3.11",
20
19
  "Programming Language :: Python :: 3.12",
21
20
  "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
22
  "Topic :: Utilities",
23
23
  ]
24
24
  dependencies = [
25
25
  "typer>=0.24.1",
26
- "sference-sdk>=0.3.2",
26
+ "sference-sdk>=0.4.0",
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -375,6 +375,13 @@ def _submit_batch(client: SferenceClient, *, input_file: str, model: Optional[st
375
375
  _fail(f"Could not read {input_file}: {exc}")
376
376
 
377
377
 
378
+ def _plain(value: object) -> object:
379
+ """API payload as plain JSON data; typed SDK models dump only the fields the server sent."""
380
+ if hasattr(value, "model_dump"):
381
+ return value.model_dump(mode="json", exclude_unset=True)
382
+ return value
383
+
384
+
378
385
  def _print(value: object, as_json: bool) -> None:
379
386
  """``--json`` prints the payload verbatim; otherwise one ``key: value`` line per field."""
380
387
  if as_json or not isinstance(value, dict):
@@ -387,7 +394,7 @@ def _print(value: object, as_json: bool) -> None:
387
394
 
388
395
 
389
396
  def _list_models(*, client: SferenceClient, as_json: bool) -> None:
390
- payload = _call_api(client.list_models)
397
+ payload = _plain(_call_api(client.list_models))
391
398
  if as_json:
392
399
  typer.echo(json.dumps(payload, indent=2, default=str))
393
400
  return
@@ -612,7 +619,10 @@ def decisions_create(
612
619
  state_json: Optional[str] = typer.Option(
613
620
  None, "--state-json", help="State as a JSON value instead of text; @path reads a file, @- stdin."
614
621
  ),
615
- timeout: float = typer.Option(30.0, "--timeout", help="HTTP read timeout in seconds."),
622
+ # Unset leaves the SDK's per-call read timeout, which outlasts the server's own deadline.
623
+ timeout: Optional[float] = typer.Option(
624
+ None, "--timeout", help="HTTP read timeout in seconds (default: as long as the server may take)."
625
+ ),
616
626
  base_url: Optional[str] = BASE_URL_OPTION,
617
627
  as_json: bool = JSON_OPTION,
618
628
  ) -> None:
@@ -643,7 +653,7 @@ def decisions_create(
643
653
 
644
654
  def _validate_login(base_url: Optional[str], token: str, as_json: bool) -> None:
645
655
  """Call GET /v1/auth/me with the credential just saved and say who it is."""
646
- me = _call_api(_client(base_url, token=token).get_me)
656
+ me = _plain(_call_api(_client(base_url, token=token).get_me))
647
657
  if as_json:
648
658
  _print(me, True)
649
659
  elif isinstance(me, dict) and "username" in me and "role" in me:
@@ -743,7 +753,7 @@ def auth_me(
743
753
  ) -> None:
744
754
  """Show the user the current credential belongs to (GET /v1/auth/me)."""
745
755
  _ensure_api_credential()
746
- _print(_call_api(_client(base_url).get_me), as_json)
756
+ _print(_plain(_call_api(_client(base_url).get_me)), as_json)
747
757
 
748
758
 
749
759
  @responses_app.command("create")
@@ -773,7 +783,10 @@ def responses_create(
773
783
  "cancelled and the command fails — use --background for long requests."
774
784
  ),
775
785
  ),
776
- timeout: float = typer.Option(600.0, "--timeout", help="HTTP read timeout in seconds."),
786
+ # Unset leaves the SDK's per-call read timeout, which outlasts the server's own deadline.
787
+ timeout: Optional[float] = typer.Option(
788
+ None, "--timeout", help="HTTP read timeout in seconds (default: as long as the server may take)."
789
+ ),
777
790
  base_url: Optional[str] = BASE_URL_OPTION,
778
791
  ) -> None:
779
792
  """Create one response (POST /v1/responses) and print it as JSON."""
File without changes
File without changes
File without changes