ap-client 0.5.3.dev3__tar.gz → 0.5.3.dev4__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.dev4}/PKG-INFO +1 -1
  2. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/ossutil_commands.py +6 -8
  3. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/ossutil_io.py +12 -12
  4. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/pyproject.toml +1 -1
  5. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/__init__.py +0 -0
  6. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/akpool_commands.py +0 -0
  7. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/api.py +0 -0
  8. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/cli.py +0 -0
  9. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/config.py +0 -0
  10. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/dataset_commands.py +0 -0
  11. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/dataset_register.py +0 -0
  12. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/exporter.py +0 -0
  13. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/fs_commands.py +0 -0
  14. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/instance_commands.py +0 -0
  15. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/irepo_sdk.py +0 -0
  16. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/managed_ak.py +0 -0
  17. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/manifest_view.py +0 -0
  18. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/profile_commands.py +0 -0
  19. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/repo_read_guard.py +0 -0
  20. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/share_api.py +0 -0
  21. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/split_publish.py +0 -0
  22. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/ap_client/tbb.py +0 -0
  23. {ap_client-0.5.3.dev3 → ap_client-0.5.3.dev4}/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.dev4
4
4
  Summary: Agent Platform API Client & CLI
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: irepo-artifact==0.2.1
@@ -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:
@@ -796,7 +797,6 @@ class OssFiles:
796
797
  src: str,
797
798
  dst: str,
798
799
  *,
799
- direction: str | None,
800
800
  recursive: bool,
801
801
  overwrite: bool,
802
802
  jobs: int,
@@ -811,7 +811,7 @@ class OssFiles:
811
811
  start_time: int | None = None,
812
812
  end_time: int | None = None,
813
813
  ) -> dict:
814
- direction = direction_for(src, dst, direction)
814
+ direction = direction_for(src, dst)
815
815
  remote_src = self.resolve(src, directory=recursive) if direction != "upload" else None
816
816
  remote_dst = None
817
817
  if direction != "download":
@@ -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.dev4"
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"