ap-client 0.8.0.dev1__tar.gz → 0.8.0.dev3__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 (36) hide show
  1. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/PKG-INFO +1 -1
  2. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/instance_commands.py +13 -5
  3. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/repo_read_guard.py +23 -0
  4. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/pyproject.toml +1 -1
  5. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/__init__.py +0 -0
  6. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/akpool_commands.py +0 -0
  7. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/api.py +0 -0
  8. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/cli.py +0 -0
  9. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/config.py +0 -0
  10. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/dataset_commands.py +0 -0
  11. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/dataset_name.py +0 -0
  12. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/dataset_register.py +0 -0
  13. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/dfs_commands.py +0 -0
  14. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/exporter.py +0 -0
  15. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/fs_commands.py +0 -0
  16. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/fs_storage.py +0 -0
  17. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/fs_transfer.py +0 -0
  18. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/instance_options.py +0 -0
  19. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/irepo_sdk.py +0 -0
  20. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/managed_ak.py +0 -0
  21. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/manifest_view.py +0 -0
  22. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/ossutil_hash.py +0 -0
  23. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/ossutil_io.py +0 -0
  24. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_cascade_all.py +0 -0
  25. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_cascade_cli.py +0 -0
  26. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_cascade_display.py +0 -0
  27. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_cascade_state.py +0 -0
  28. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_commands.py +0 -0
  29. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_diagnostics.py +0 -0
  30. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_display.py +0 -0
  31. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/profile_references.py +0 -0
  32. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/share_api.py +0 -0
  33. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/split_publish.py +0 -0
  34. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/submission_metadata.py +0 -0
  35. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/tbb.py +0 -0
  36. {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev3}/ap_client/waiter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ap-client
3
- Version: 0.8.0.dev1
3
+ Version: 0.8.0.dev3
4
4
  Summary: Agent Platform API Client & CLI
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: irepo-artifact==0.2.6
@@ -956,6 +956,7 @@ def instance_pull(
956
956
  dataset: str = typer.Option(..., "--dataset", help="Dataset name"),
957
957
  split: str = typer.Option(..., "--split", help="Split name (required for remote operations)"),
958
958
  version: Optional[str] = typer.Option(None, "--version", help=_VERSION_HELP),
959
+ environment: Optional[str] = typer.Option(None, "--environment", help=_ENVIRONMENT_HELP),
959
960
  output: Optional[str] = typer.Option(
960
961
  None, "--output", "-o", help="Output directory (default: current directory)"
961
962
  ),
@@ -971,6 +972,7 @@ def instance_pull(
971
972
  from .irepo_sdk import sdk_error_exit
972
973
 
973
974
  output_format = _fmt(output_format)
975
+ env = _environment(environment)
974
976
  resolved_path = _path_value(path)
975
977
  resolved = _version_value(version)
976
978
  root = Path(output or ".")
@@ -982,9 +984,17 @@ def instance_pull(
982
984
  )
983
985
 
984
986
  repo = _load_repo_or_exit()
985
- pull_options = {}
987
+ from .repo_read_guard import pull_client
988
+
989
+ try:
990
+ client = pull_client(repo.instances, env)
991
+ pull_options = oss_fallback_kwargs(repo, client, "pull", env)
992
+ except (TypeError, ValueError, RuntimeError) as exc:
993
+ raise _fail(
994
+ str(exc), "Upgrade Dataset support: pip install --upgrade 'ap-client[dataset]'", 2
995
+ ) from exc
986
996
  if resolved_path is not None:
987
- pull_options = _enhanced_options(repo.instances, "pull", {"path": resolved_path})
997
+ pull_options.update(_enhanced_options(client, "pull", {"path": resolved_path}))
988
998
  try:
989
999
  private_endpoint_reachable = _probe_pull_private_endpoint(repo, dataset)
990
1000
  except Exception as exc: # noqa: BLE001
@@ -1001,9 +1011,7 @@ def instance_pull(
1001
1011
  staging = Path(tempfile.mkdtemp(prefix=f"ap-pull-{instance}-"))
1002
1012
  try:
1003
1013
  try:
1004
- written = repo.instances.pull(
1005
- dataset, resolved, instance, staging, split, **pull_options
1006
- )
1014
+ written = client.pull(dataset, resolved, instance, staging, split, **pull_options)
1007
1015
  except Exception as exc: # noqa: BLE001
1008
1016
  sdk_error_exit(exc, what=f"instance {instance}", stage="pull")
1009
1017
  staged = _place_under_target(Path(str(written)), staging / instance)
@@ -3,6 +3,8 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import inspect
6
+ from copy import copy
7
+ from functools import partial
6
8
  from typing import Any
7
9
 
8
10
  STORAGE_SIDES = {
@@ -13,6 +15,27 @@ STORAGE_SIDES = {
13
15
  }
14
16
 
15
17
 
18
+ def pull_client(client: Any, environment: str) -> Any:
19
+ """Scope SDK 1.4.x pull metadata reads without changing its storage binding.
20
+
21
+ pull has no environment argument, although its registry supports one.
22
+ Copy both objects so other operations on the Repo keep their original context.
23
+ """
24
+ if environment == "auto":
25
+ return client
26
+ registry = getattr(client, "_reg", None)
27
+ get = getattr(registry, "get", None)
28
+ if not callable(get) or "environment" not in inspect.signature(get).parameters:
29
+ raise ValueError(
30
+ "The installed instance-repo cannot scope pull metadata reads; "
31
+ "upgrade 'ap-client[dataset]'"
32
+ )
33
+ scoped = copy(client)
34
+ scoped._reg = copy(registry)
35
+ scoped._reg.get = partial(get, environment=environment)
36
+ return scoped
37
+
38
+
16
39
  def oss_fallback_kwargs(repo: Any, client: Any, method: str, environment: str) -> dict:
17
40
  """Allow API reads across environments; disable unsafe storage fallback.
18
41
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ap-client"
7
- version = "0.8.0.dev1"
7
+ version = "0.8.0.dev3"
8
8
  description = "Agent Platform API Client & CLI"
9
9
  readme = { text = "A lightweight Python SDK and command line interface for Agent Platform. It provides helpers for configuring API access and managing templates, datasets, jobs, and groups.", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"