unitlab 2.4.3__tar.gz → 2.4.4__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.
- {unitlab-2.4.3 → unitlab-2.4.4}/PKG-INFO +1 -1
- {unitlab-2.4.3 → unitlab-2.4.4}/pyproject.toml +1 -1
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/cli.py +6 -9
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/client.py +33 -1
- {unitlab-2.4.3 → unitlab-2.4.4}/.claude/settings.local.json +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/.gitignore +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/LICENSE.md +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/README.md +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/__init__.py +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/__main__.py +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/_config.py +0 -0
- {unitlab-2.4.3 → unitlab-2.4.4}/src/unitlab/exceptions.py +0 -0
|
@@ -37,12 +37,6 @@ class DownloadType(str, Enum):
|
|
|
37
37
|
files = "files"
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
class DatasetSplit(str, Enum):
|
|
41
|
-
train = "train"
|
|
42
|
-
validation = "validation"
|
|
43
|
-
test = "test"
|
|
44
|
-
|
|
45
|
-
|
|
46
40
|
@app.command(help="Configure the credentials")
|
|
47
41
|
def configure(
|
|
48
42
|
api_key: Annotated[
|
|
@@ -124,11 +118,14 @@ def dataset_download(
|
|
|
124
118
|
typer.Option(help="Export type (e.g. COCO, YOLOv8, YOLOv5, UUEF)"),
|
|
125
119
|
] = "COCO",
|
|
126
120
|
split_type: Annotated[
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
str | None,
|
|
122
|
+
typer.Option(
|
|
123
|
+
help="Dataset split (e.g. train, validation). Auto-detected if omitted."
|
|
124
|
+
),
|
|
125
|
+
] = None,
|
|
129
126
|
):
|
|
130
127
|
if download_type == DownloadType.annotation:
|
|
131
|
-
get_client(api_key).dataset_download(str(pk), export_type, split_type
|
|
128
|
+
get_client(api_key).dataset_download(str(pk), export_type, split_type)
|
|
132
129
|
else:
|
|
133
130
|
typer.echo(get_client(api_key).dataset_download_files(str(pk)))
|
|
134
131
|
|
|
@@ -308,9 +308,41 @@ class UnitlabClient:
|
|
|
308
308
|
def datasets(self, pretty: int = 0) -> Any:
|
|
309
309
|
return self._get(f"/api/sdk/datasets/?pretty={pretty}")
|
|
310
310
|
|
|
311
|
+
def dataset_info(self, dataset_id: str) -> Any:
|
|
312
|
+
"""Return metadata for a dataset.
|
|
313
|
+
|
|
314
|
+
Includes name, version, annotation_type, number_of_data,
|
|
315
|
+
download_formats and the list of available ``splits``.
|
|
316
|
+
"""
|
|
317
|
+
return self._get(f"/api/sdk/datasets/{dataset_id}/")
|
|
318
|
+
|
|
311
319
|
def dataset_download(
|
|
312
|
-
self,
|
|
320
|
+
self,
|
|
321
|
+
dataset_id: str,
|
|
322
|
+
export_type: str,
|
|
323
|
+
split_type: str | None = None,
|
|
313
324
|
) -> str:
|
|
325
|
+
if split_type is None:
|
|
326
|
+
info = self.dataset_info(dataset_id)
|
|
327
|
+
splits = info.get("splits") or []
|
|
328
|
+
if not splits:
|
|
329
|
+
raise NetworkError(
|
|
330
|
+
message=(
|
|
331
|
+
"No splits available for this dataset. Nothing to download."
|
|
332
|
+
),
|
|
333
|
+
detail=None,
|
|
334
|
+
)
|
|
335
|
+
if len(splits) > 1:
|
|
336
|
+
raise NetworkError(
|
|
337
|
+
message=(
|
|
338
|
+
f"Multiple splits available: {', '.join(splits)}. "
|
|
339
|
+
f"Specify one with split_type=..."
|
|
340
|
+
),
|
|
341
|
+
detail=None,
|
|
342
|
+
)
|
|
343
|
+
split_type = splits[0]
|
|
344
|
+
logger.info(f"Auto-selected split: {split_type}")
|
|
345
|
+
|
|
314
346
|
response = self._post(
|
|
315
347
|
f"/api/sdk/datasets/{dataset_id}/",
|
|
316
348
|
data={
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|