ap-client 0.5.3.dev3__tar.gz → 0.5.3.dev5__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 (23) hide show
  1. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/PKG-INFO +3 -3
  2. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/ossutil_commands.py +6 -8
  3. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/ossutil_io.py +13 -19
  4. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/repo_read_guard.py +1 -1
  5. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/pyproject.toml +3 -3
  6. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/__init__.py +0 -0
  7. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/akpool_commands.py +0 -0
  8. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/api.py +0 -0
  9. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/cli.py +0 -0
  10. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/config.py +0 -0
  11. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/dataset_commands.py +0 -0
  12. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/dataset_register.py +0 -0
  13. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/exporter.py +0 -0
  14. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/fs_commands.py +0 -0
  15. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/instance_commands.py +0 -0
  16. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/irepo_sdk.py +0 -0
  17. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/managed_ak.py +0 -0
  18. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/manifest_view.py +0 -0
  19. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/profile_commands.py +0 -0
  20. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/share_api.py +0 -0
  21. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/split_publish.py +0 -0
  22. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/tbb.py +0 -0
  23. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev5}/ap_client/waiter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ap-client
3
- Version: 0.5.3.dev3
3
+ Version: 0.5.3.dev5
4
4
  Summary: Agent Platform API Client & CLI
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: irepo-artifact==0.2.1
@@ -10,9 +10,9 @@ Requires-Dist: rich>=13.0.0
10
10
  Requires-Dist: typer>=0.9.0
11
11
  Requires-Dist: websockets>=13.0
12
12
  Provides-Extra: all
13
- Requires-Dist: instance-repo[oss]<2.0.0,>=1.3.5.dev2; extra == 'all'
13
+ Requires-Dist: instance-repo[oss]<2.0.0,>=1.3.5.dev3; extra == 'all'
14
14
  Provides-Extra: dataset
15
- Requires-Dist: instance-repo[oss]<2.0.0,>=1.3.5.dev2; extra == 'dataset'
15
+ Requires-Dist: instance-repo[oss]<2.0.0,>=1.3.5.dev3; extra == 'dataset'
16
16
  Description-Content-Type: text/markdown
17
17
 
18
18
  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.
@@ -8,7 +8,7 @@ from typing import Optional
8
8
 
9
9
  import typer
10
10
 
11
- from .ossutil_io import OssBinding, OssFiles, OssUsageError, safe_error
11
+ from .ossutil_io import OssBinding, OssFiles, OssUsageError, direction_for, safe_error
12
12
 
13
13
  ossutil_app = typer.Typer(
14
14
  help="OSS file operations within the server-configured storage prefix", no_args_is_help=True
@@ -220,11 +220,8 @@ def oss_cat(
220
220
 
221
221
  @ossutil_app.command("cp")
222
222
  def oss_cp(
223
- src: str = typer.Argument(..., help="Local path, full OSS URI or remote relative path"),
224
- dst: str = typer.Argument(..., help="Local path, full OSS URI or remote relative path"),
225
- direction: Optional[str] = typer.Option(
226
- None, "--direction", help="AP extension for two relative paths: upload/download/copy"
227
- ),
223
+ src: str = typer.Argument(..., help="Local path or full oss:// URI"),
224
+ dst: str = typer.Argument(..., help="Local path or full oss:// URI"),
228
225
  recursive: bool = typer.Option(False, "--recursive", "-r"),
229
226
  force: bool = typer.Option(False, "--force", "-f", help="Overwrite without confirmation"),
230
227
  update: bool = typer.Option(False, "--update", "-u", help="Copy only missing or older targets"),
@@ -251,7 +248,8 @@ def oss_cp(
251
248
  payer: Optional[str] = typer.Option(None, "--payer"),
252
249
  output_format: Optional[str] = typer.Option(None, "--output-format", "--format"),
253
250
  ):
254
- """Upload, download or copy objects. Downloads require private-network access."""
251
+ """Upload, download or copy objects. One operand must be a full oss:// URI.
252
+ Downloads require private-network access."""
255
253
  lock = threading.Lock()
256
254
 
257
255
  def progress(path, done, total):
@@ -280,6 +278,7 @@ def oss_cp(
280
278
  fmt = _format(output_format)
281
279
  if start_time is not None and end_time is not None and start_time > end_time:
282
280
  raise OssUsageError("--start-time cannot be later than --end-time")
281
+ direction_for(src, dst)
283
282
  files = _files()
284
283
  _configure(files, encoding_type, payer)
285
284
  files.disable_crc64 = disable_crc64
@@ -316,7 +315,6 @@ def oss_cp(
316
315
  result = files.cp(
317
316
  src,
318
317
  dst,
319
- direction=direction,
320
318
  recursive=recursive,
321
319
  overwrite=force,
322
320
  jobs=jobs,
@@ -140,17 +140,18 @@ class RemotePath:
140
140
  path: str
141
141
 
142
142
 
143
- def direction_for(src: str, dst: str, direction: str | None) -> str:
143
+ def direction_for(src: str, dst: str) -> str:
144
+ """Infer cp direction the way ossutil does: at least one operand is an OSS URI."""
144
145
  remote_src, remote_dst = src.startswith("oss://"), dst.startswith("oss://")
145
- if direction is None:
146
- if not remote_src and not remote_dst:
147
- raise OssUsageError("Relative cp paths require --direction upload, download or copy")
148
- direction = "copy" if remote_src and remote_dst else "download" if remote_src else "upload"
149
- if direction not in ("upload", "download", "copy"):
150
- raise OssUsageError("--direction must be upload, download or copy")
151
- if direction == "upload" and remote_src or direction == "download" and remote_dst:
152
- raise OssUsageError("The local cp operand cannot be an OSS URI")
153
- return direction
146
+ if remote_src and remote_dst:
147
+ return "copy"
148
+ if remote_src:
149
+ return "download"
150
+ if remote_dst:
151
+ return "upload"
152
+ raise OssUsageError(
153
+ "cp requires at least one operand starting with oss://; paths without it are local"
154
+ )
154
155
 
155
156
 
156
157
  def matches(path: str, include: tuple[str, ...], exclude: tuple[str, ...]) -> bool:
@@ -284,20 +285,14 @@ class OssFiles:
284
285
  def resolve(self, value: str, **kwargs) -> RemotePath:
285
286
  return self.binding.resolve(value, encoding_type=self.encoding_type, **kwargs)
286
287
 
287
- def _dataset_for(self, scope: str) -> str | None:
288
- if not scope.startswith(self.binding.prefix):
289
- raise OssUsageError("OSS path is outside repo-config prefix")
290
- relative = scope[len(self.binding.prefix) :].rstrip("/")
291
- return "/".join(relative.split("/")[:2]) if relative else None
292
-
293
288
  def _credentials(self, scope: str, permission: str, list_only: bool) -> dict:
294
289
  cred = dict(
295
290
  self.repo.transport.get_oss_credentials(
296
291
  self.binding.bucket,
297
292
  scope,
298
- dataset_name=self._dataset_for(scope),
299
293
  permission=permission,
300
294
  list_only=list_only,
295
+ dataset_source="oss",
301
296
  )
302
297
  )
303
298
  # The SDK treats OSS_REGION as optional; repo-config supplies the signing region.
@@ -796,7 +791,6 @@ class OssFiles:
796
791
  src: str,
797
792
  dst: str,
798
793
  *,
799
- direction: str | None,
800
794
  recursive: bool,
801
795
  overwrite: bool,
802
796
  jobs: int,
@@ -811,7 +805,7 @@ class OssFiles:
811
805
  start_time: int | None = None,
812
806
  end_time: int | None = None,
813
807
  ) -> dict:
814
- direction = direction_for(src, dst, direction)
808
+ direction = direction_for(src, dst)
815
809
  remote_src = self.resolve(src, directory=recursive) if direction != "upload" else None
816
810
  remote_dst = None
817
811
  if direction != "download":
@@ -20,7 +20,7 @@ def oss_fallback_kwargs(repo: Any, client: Any, method: str, environment: str) -
20
20
  discovery. auto follows the bound store. Bind missing SDK discovery provenance.
21
21
  """
22
22
  profile = getattr(repo, "profile", None)
23
- # instance-repo 1.3.5.dev2 reads _p in Dataset discovery without binding it
23
+ # instance-repo 1.3.5.dev2+ reads _p in Dataset discovery without binding it
24
24
  # during construction. Supply the actual Repo profile before that check.
25
25
  if callable(getattr(client, "_discovery_env_match", None)) and not hasattr(client, "_p"):
26
26
  client._p = profile
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ap-client"
7
- version = "0.5.3.dev3"
7
+ version = "0.5.3.dev5"
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"
@@ -19,10 +19,10 @@ dependencies = [
19
19
 
20
20
  [project.optional-dependencies]
21
21
  dataset = [
22
- "instance-repo[oss]>=1.3.5.dev2,<2.0.0",
22
+ "instance-repo[oss]>=1.3.5.dev3,<2.0.0",
23
23
  ]
24
24
  all = [
25
- "instance-repo[oss]>=1.3.5.dev2,<2.0.0",
25
+ "instance-repo[oss]>=1.3.5.dev3,<2.0.0",
26
26
  ]
27
27
 
28
28
  [project.scripts]