instance-repo 1.4.0.dev4__tar.gz → 1.4.1.dev0__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 (49) hide show
  1. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/PKG-INFO +1 -1
  2. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/__init__.py +1 -1
  3. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/cli.py +27 -12
  4. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/paths.py +19 -10
  5. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/oss_discovery.py +1 -1
  6. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/PKG-INFO +1 -1
  7. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/pyproject.toml +1 -1
  8. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/README.md +0 -0
  9. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/_routing.py +0 -0
  10. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/_site_defaults.py +0 -0
  11. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/artifacts.py +0 -0
  12. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/bootstrap.py +0 -0
  13. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/cache.py +0 -0
  14. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/__init__.py +0 -0
  15. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/benchmarks.py +0 -0
  16. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/config.py +0 -0
  17. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/datasets.py +0 -0
  18. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/images.py +0 -0
  19. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/instances.py +0 -0
  20. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/reports.py +0 -0
  21. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/scaffold.py +0 -0
  22. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/splits.py +0 -0
  23. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/versions.py +0 -0
  24. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/clients/workflows.py +0 -0
  25. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/concurrency.py +0 -0
  26. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/content.py +0 -0
  27. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/endpoints.py +0 -0
  28. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/errors.py +0 -0
  29. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/image.py +0 -0
  30. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/layout.py +0 -0
  31. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/loader.py +0 -0
  32. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/models.py +0 -0
  33. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/release.py +0 -0
  34. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/repo.py +0 -0
  35. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/retry.py +0 -0
  36. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/__init__.py +0 -0
  37. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/acr.py +0 -0
  38. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/base.py +0 -0
  39. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/oss.py +0 -0
  40. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/store/registry.py +0 -0
  41. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/tasktoml.py +0 -0
  42. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/transport.py +0 -0
  43. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo/validate.py +0 -0
  44. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/SOURCES.txt +0 -0
  45. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/dependency_links.txt +0 -0
  46. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/entry_points.txt +0 -0
  47. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/requires.txt +0 -0
  48. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/instance_repo.egg-info/top_level.txt +0 -0
  49. {instance_repo-1.4.0.dev4 → instance_repo-1.4.1.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instance-repo
3
- Version: 1.4.0.dev4
3
+ Version: 1.4.1.dev0
4
4
  Summary: InstanceRepo SDK — 评测 Instance 统一存储客户端(SDK-only;控制面由 apiserver 承载)
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -20,7 +20,7 @@ from .errors import (
20
20
  RegistrationFailed, TransportError,
21
21
  )
22
22
 
23
- __version__ = "1.4.0.dev4"
23
+ __version__ = "1.4.1.dev0"
24
24
 
25
25
  __all__ = [
26
26
  "Repo", "load_instances",
@@ -451,9 +451,16 @@ def build_parser() -> argparse.ArgumentParser:
451
451
 
452
452
 
453
453
  def _split_ref(ref: str, parts: int) -> list[str]:
454
+ """切分位置参数 ref:尾部 ``parts-2`` 段是 version/instance-id 槽位,其余(≥1 段)
455
+ 全部是 dataset 名——多段 dataset 名 (``A/B/C``) 因此可以原样出现在 ref 里。
456
+
457
+ ``parts=2`` 时 ref 整体就是 dataset 名(无尾部槽位)。
458
+ """
454
459
  segs = ref.split("/")
455
- if len(segs) != parts:
456
- raise SystemExit(f"ref must have {parts} segments, got {ref!r}")
460
+ minimum = parts - 1
461
+ if len(segs) < minimum:
462
+ raise SystemExit(
463
+ f"ref must have at least {minimum} segments, got {ref!r}")
457
464
  return segs
458
465
 
459
466
 
@@ -475,15 +482,18 @@ def _split_instance_count(split) -> int:
475
482
 
476
483
 
477
484
  def _resolve_split_ref(args) -> tuple[str, str]:
478
- """定位 dataset + split:位置 ref({L1}/{L2}/{split})或 --dataset/--split。"""
485
+ """定位 dataset + split:位置 ref(``{dataset}/{split}``)或 --dataset/--split。
486
+
487
+ 多段 dataset 名时 split 取最后一节,前面所有段拼回 dataset 名。
488
+ """
479
489
  if args.dataset:
480
490
  if not args.split:
481
491
  raise SystemExit("给定 --dataset 时 split 需要 --split")
482
492
  return args.dataset, args.split
483
493
  if args.ref:
484
494
  segs = _split_ref(args.ref, 3)
485
- return f"{segs[0]}/{segs[1]}", segs[2]
486
- raise SystemExit("split get/create/set-run-type 需要 {L1}/{L2}/{split} 或 "
495
+ return "/".join(segs[:-1]), segs[-1]
496
+ raise SystemExit("split get/create/set-run-type 需要 {dataset}/{split} 或 "
487
497
  "--dataset/--split")
488
498
 
489
499
 
@@ -493,15 +503,15 @@ def _split_dataset(dataset: str) -> tuple[str, str]:
493
503
  name = P.DatasetName.parse(dataset)
494
504
  except InstanceRepoError as exc:
495
505
  raise SystemExit(
496
- f"--dataset must be one or two canonical segments, got "
506
+ f"--dataset must be one or more canonical segments, got "
497
507
  f"{dataset!r}") from exc
498
508
  return name.l1, name.l2
499
509
 
500
510
 
501
511
  _TARGET_SHAPE = {
502
- 2: ("{L1}/{L2}", "--dataset"),
503
- 3: ("{L1}/{L2}/{version}", "--dataset --version"),
504
- 4: ("{L1}/{L2}/{version}/{id}", "--dataset --version --instance-id"),
512
+ 2: ("{dataset}", "--dataset"),
513
+ 3: ("{dataset}/{version}", "--dataset --version"),
514
+ 4: ("{dataset}/{version}/{id}", "--dataset --version --instance-id"),
505
515
  }
506
516
 
507
517
 
@@ -532,9 +542,14 @@ def _resolve_target(args, parts: int) -> tuple[str, str | None, str | None]:
532
542
  f"(ref={ref!r})")
533
543
  if ref:
534
544
  segs = _split_ref(ref, parts)
535
- return ("/".join(segs[:2]),
536
- segs[2] if parts >= 3 else None,
537
- segs[3] if parts >= 4 else None)
545
+ # 尾部 parts-2 段是 version/instance-id 槽位,其余全部是 dataset 名
546
+ # (多段 dataset 名按原样保留)。
547
+ slots = parts - 2
548
+ if slots == 0:
549
+ return ("/".join(segs), None, None)
550
+ if slots == 1:
551
+ return ("/".join(segs[:-1]), segs[-1], None)
552
+ return ("/".join(segs[:-2]), segs[-2], segs[-1])
538
553
  if not given:
539
554
  raise SystemExit(
540
555
  f"需要位置参数 ref({shape})或 flag 形式({flag_hint})")
@@ -21,7 +21,7 @@ from dataclasses import dataclass
21
21
  from .errors import SchemaError
22
22
 
23
23
 
24
- def _dataset_name_parts(value: object) -> tuple[str, str, tuple[str, ...], str]:
24
+ def _dataset_name_parts(value: object) -> tuple[str, str, str, tuple[str, ...], str]:
25
25
  if not isinstance(value, str):
26
26
  raise SchemaError(f"dataset must be a string, got {type(value).__name__}")
27
27
  segments = tuple(value.split("/"))
@@ -34,17 +34,20 @@ def _dataset_name_parts(value: object) -> tuple[str, str, tuple[str, ...], str]:
34
34
  or any(unicodedata.category(char) == "Cc" for char in segment)
35
35
  for segment in segments
36
36
  )
37
- if len(segments) not in (1, 2) or invalid_segment:
37
+ if not segments or invalid_segment:
38
38
  raise SchemaError(
39
- f"dataset must contain one or two canonical segments, got {value!r}")
39
+ f"dataset must contain one or more canonical segments, got {value!r}")
40
40
  l1 = segments[0]
41
- l2 = segments[1] if len(segments) == 2 else ""
42
- return l1, l2, segments, segments[-1]
41
+ # 多段名(3+ 段)里 l2 是 l1 之下的完整后缀路径(含 "/"),保持
42
+ # "l2 为空 ⇔ 根(L1)" 的不变量与 {l1,l2} 家族索引语义不变。
43
+ l2 = "/".join(segments[1:])
44
+ namespace = "/".join(segments[:-1])
45
+ return l1, l2, namespace, segments, segments[-1]
43
46
 
44
47
 
45
48
  @dataclass(frozen=True)
46
49
  class DatasetName:
47
- """Canonical one- or two-segment dataset name.
50
+ """Canonical dataset name: one segment (L1) or more (L1/L2/...).
48
51
 
49
52
  Direct construction is supported only when every derived field matches
50
53
  ``canonical``; otherwise construction raises :class:`SchemaError`.
@@ -53,24 +56,26 @@ class DatasetName:
53
56
  canonical: str
54
57
  l1: str
55
58
  l2: str
59
+ namespace: str
56
60
  segments: tuple[str, ...]
57
61
  leaf: str
58
62
 
59
63
  def __post_init__(self) -> None:
60
64
  expected = _dataset_name_parts(self.canonical)
61
- actual = (self.l1, self.l2, self.segments, self.leaf)
65
+ actual = (self.l1, self.l2, self.namespace, self.segments, self.leaf)
62
66
  if actual != expected:
63
67
  raise SchemaError(
64
68
  "DatasetName fields must match canonical: expected "
65
- f"(l1, l2, segments, leaf)={expected!r}, got {actual!r}")
69
+ f"(l1, l2, namespace, segments, leaf)={expected!r}, got {actual!r}")
66
70
 
67
71
  @classmethod
68
72
  def parse(cls, value: str) -> DatasetName:
69
- l1, l2, segments, leaf = _dataset_name_parts(value)
73
+ l1, l2, namespace, segments, leaf = _dataset_name_parts(value)
70
74
  return cls(
71
75
  canonical=value,
72
76
  l1=l1,
73
77
  l2=l2,
78
+ namespace=namespace,
74
79
  segments=segments,
75
80
  leaf=leaf,
76
81
  )
@@ -82,7 +87,11 @@ class DatasetName:
82
87
 
83
88
 
84
89
  def split_dataset(dataset: str) -> tuple[str, str]:
85
- """Return ``(L1, L2)``; single-segment datasets use an empty L2."""
90
+ """Return ``(L1, L2)``; single-segment datasets use an empty L2.
91
+
92
+ For multi-level names (3+ segments) ``L2`` is the full suffix path under
93
+ ``L1`` (segments joined by ``/``), e.g. ``"A/B/C"`` → ``("A", "B/C")``.
94
+ """
86
95
  name = DatasetName.parse(dataset)
87
96
  return name.l1, name.l2
88
97
 
@@ -221,7 +221,7 @@ def parse_dataset_level(
221
221
 
222
222
  Args:
223
223
  content_store: :class:`~instance_repo.store.oss.OssContentStore` instance.
224
- dataset: Canonical dataset name with one or two segments.
224
+ dataset: Canonical dataset name with one or more segments.
225
225
  oss_prefix: Root prefix inside the bucket (default ``"swe/datasets"``).
226
226
  max_versions: Upper bound on the number of versions to probe. When
227
227
  exceeded the result is truncated and ``truncated=True`` is set.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instance-repo
3
- Version: 1.4.0.dev4
3
+ Version: 1.4.1.dev0
4
4
  Summary: InstanceRepo SDK — 评测 Instance 统一存储客户端(SDK-only;控制面由 apiserver 承载)
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "instance-repo"
7
- version = "1.4.0.dev4"
7
+ version = "1.4.1.dev0"
8
8
  description = "InstanceRepo SDK — 评测 Instance 统一存储客户端(SDK-only;控制面由 apiserver 承载)"
9
9
  requires-python = ">=3.10"
10
10
  readme = "README.md"