unitlab 2.4.3__tar.gz → 2.4.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitlab
3
- Version: 2.4.3
3
+ Version: 2.4.5
4
4
  Summary: Python SDK for the Unitlab.ai data annotation platform
5
5
  Project-URL: Homepage, https://unitlab.ai
6
6
  Project-URL: Documentation, https://docs.unitlab.ai
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "unitlab"
7
- version = "2.4.3"
7
+ version = "2.4.5"
8
8
  description = "Python SDK for the Unitlab.ai data annotation platform"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -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
- DatasetSplit, typer.Option(help="Dataset split (train, validation, test)")
128
- ] = DatasetSplit.train,
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.value)
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
 
@@ -309,16 +309,19 @@ class UnitlabClient:
309
309
  return self._get(f"/api/sdk/datasets/?pretty={pretty}")
310
310
 
311
311
  def dataset_download(
312
- self, dataset_id: str, export_type: str, split_type: str
312
+ self,
313
+ dataset_id: str,
314
+ export_type: str,
315
+ split_type: str | None = None,
313
316
  ) -> str:
314
- response = self._post(
315
- f"/api/sdk/datasets/{dataset_id}/",
316
- data={
317
- "download_type": "annotation",
318
- "export_type": export_type,
319
- "split_type": split_type,
320
- },
321
- )
317
+ data: dict[str, Any] = {
318
+ "download_type": "annotation",
319
+ "export_type": export_type,
320
+ }
321
+ if split_type is not None:
322
+ data["split_type"] = split_type
323
+
324
+ response = self._post(f"/api/sdk/datasets/{dataset_id}/", data=data)
322
325
 
323
326
  file_url = response["file"]
324
327
  try:
@@ -397,7 +400,9 @@ class UnitlabClient:
397
400
 
398
401
  async def main() -> None:
399
402
  with tqdm.tqdm(total=len(files_to_download), ncols=80) as pbar:
400
- async with httpx.AsyncClient(timeout=600.0) as client:
403
+ async with httpx.AsyncClient(
404
+ timeout=600.0, follow_redirects=True
405
+ ) as client:
401
406
  tasks = [
402
407
  download_file(client=client, dataset_file=df)
403
408
  for df in files_to_download
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes