unitlab 3.1.1__tar.gz → 3.1.3__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 (45) hide show
  1. {unitlab-3.1.1 → unitlab-3.1.3}/PKG-INFO +2 -2
  2. {unitlab-3.1.1 → unitlab-3.1.3}/README.md +1 -1
  3. {unitlab-3.1.1 → unitlab-3.1.3}/pyproject.toml +1 -1
  4. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/annotation_imports.py +7 -3
  5. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/releases.py +20 -0
  6. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_annotation_imports.py +1 -1
  7. {unitlab-3.1.1 → unitlab-3.1.3}/.gitignore +0 -0
  8. {unitlab-3.1.1 → unitlab-3.1.3}/LICENSE.md +0 -0
  9. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/__init__.py +0 -0
  10. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/__main__.py +0 -0
  11. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_config.py +0 -0
  12. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_downloader.py +0 -0
  13. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_grouping.py +0 -0
  14. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_http.py +0 -0
  15. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_nuscenes.py +0 -0
  16. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_scene_uploader.py +0 -0
  17. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_scenes.py +0 -0
  18. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_uploader.py +0 -0
  19. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/_waiter.py +0 -0
  20. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/cli.py +0 -0
  21. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/client.py +0 -0
  22. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/exceptions.py +0 -0
  23. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/ontology.py +0 -0
  24. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/py.typed +0 -0
  25. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/__init__.py +0 -0
  26. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/_base.py +0 -0
  27. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/assets.py +0 -0
  28. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/cloud.py +0 -0
  29. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/datasets.py +0 -0
  30. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/embeddings.py +0 -0
  31. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/ontologies.py +0 -0
  32. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/projects.py +0 -0
  33. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/resources/workflow.py +0 -0
  34. {unitlab-3.1.1 → unitlab-3.1.3}/src/unitlab/types.py +0 -0
  35. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_cli.py +0 -0
  36. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_client.py +0 -0
  37. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_downloader.py +0 -0
  38. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_embeddings.py +0 -0
  39. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_http.py +0 -0
  40. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_nuscenes.py +0 -0
  41. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_scene_cli.py +0 -0
  42. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_scene_uploads.py +0 -0
  43. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_scenes.py +0 -0
  44. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_tiled_uploads.py +0 -0
  45. {unitlab-3.1.1 → unitlab-3.1.3}/tests/test_uploader.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: unitlab
3
- Version: 3.1.1
3
+ Version: 3.1.3
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
@@ -441,7 +441,7 @@ Supported inputs are COCO JSON, Unitlab exports (UUEF item JSON, Audio JSON and
441
441
  GeoJSON, as `.json` or `.geojson`), `unitlab-image/1` and `unitlab-video/1`. They
442
442
  cover image, video, medical, document, audio, time series, text, HTML, geospatial
443
443
  and pathology items. A UUEF file holds one item: import each file as its own batch.
444
- Each JSON file is limited to 600 MiB. The backend matches original media paths/IDs,
444
+ Each JSON file is limited to 80 MiB. The backend matches original media paths/IDs,
445
445
  with a unique-filename fallback; ambiguous names require an explicit mapping.
446
446
  YOLO text/ZIP files and other tools' project files are not accepted by this importer.
447
447
 
@@ -408,7 +408,7 @@ Supported inputs are COCO JSON, Unitlab exports (UUEF item JSON, Audio JSON and
408
408
  GeoJSON, as `.json` or `.geojson`), `unitlab-image/1` and `unitlab-video/1`. They
409
409
  cover image, video, medical, document, audio, time series, text, HTML, geospatial
410
410
  and pathology items. A UUEF file holds one item: import each file as its own batch.
411
- Each JSON file is limited to 600 MiB. The backend matches original media paths/IDs,
411
+ Each JSON file is limited to 80 MiB. The backend matches original media paths/IDs,
412
412
  with a unique-filename fallback; ambiguous names require an explicit mapping.
413
413
  YOLO text/ZIP files and other tools' project files are not accepted by this importer.
414
414
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "unitlab"
7
- version = "3.1.1"
7
+ version = "3.1.3"
8
8
  description = "Python SDK for the Unitlab.ai data annotation platform"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -13,7 +13,11 @@ from ._base import Namespace, identifier
13
13
  if TYPE_CHECKING:
14
14
  from unitlab.client import UnitlabClient
15
15
 
16
- MAX_FILE_BYTES = 600 * 1024 * 1024
16
+ # The server's cap (nbackend annotation_import_service.MAX_FILE_BYTES): a batch
17
+ # stores its parsed rows as one jsonb value, which PostgreSQL caps at ~256 MiB,
18
+ # and parsed rows take 2.2-2.8x the file. Checked here so a larger file fails
19
+ # before its upload instead of with the server's 400 after it.
20
+ MAX_FILE_BYTES = 80 * 1024 * 1024
17
21
  # Preview and commit re-check every row and item on the server; live runs on
18
22
  # large files took over a minute, past the client's 60 s default.
19
23
  SERVER_WORK_TIMEOUT = 300
@@ -55,7 +59,7 @@ class AnnotationImports(Namespace):
55
59
  """Upload COCO, Unitlab export or native JSON and return a label preview.
56
60
 
57
61
  Supply a local ``annotation_file`` or a saved ``cloud_storage`` handle/ID
58
- and ``annotation_key``. JSON files are limited to 600 MiB each. Media must
62
+ and ``annotation_key``. JSON files are limited to 80 MiB each. Media must
59
63
  already belong to this project; use ``UploadBatch.wait()`` after upload.
60
64
 
61
65
  Exactly one prediction namespace, ``source_name`` or ``source_id``, is
@@ -118,7 +122,7 @@ class AnnotationImports(Namespace):
118
122
  stream = stack.enter_context(path.open("rb"))
119
123
  stream.seek(0, 2)
120
124
  if stream.tell() > MAX_FILE_BYTES:
121
- raise ValueError(f"{name} must be 600 MiB or smaller.")
125
+ raise ValueError(f"{name} must be 80 MiB or smaller.")
122
126
  stream.seek(0)
123
127
  files[name] = (path.name, stream, "application/json")
124
128
  if files:
@@ -35,6 +35,7 @@ class ReleasesNamespace(Namespace):
35
35
  data_types=None,
36
36
  bundle_formats: dict[str, str] | None = None,
37
37
  license_id: str | None = None,
38
+ completed_only: bool = False,
38
39
  wait: bool = True,
39
40
  timeout: float = 7200,
40
41
  ) -> Release:
@@ -61,6 +62,11 @@ class ReleasesNamespace(Namespace):
61
62
  includes every available concrete type.
62
63
  bundle_formats: Per-concrete-data-type formats for multimodal bundles.
63
64
  license_id: Optional Dataset license ID.
65
+ completed_only: Only items whose current workflow status is
66
+ Complete (a Data Group by its own status), with their latest
67
+ labels. Raises ``UnitlabError`` (code
68
+ ``completed_only_unsupported``) if the server does not know the
69
+ option, instead of returning a Release of every item.
64
70
  wait: Block until the Release is ready or has failed.
65
71
  timeout: Seconds to wait for preparation when ``wait`` is true.
66
72
 
@@ -98,6 +104,9 @@ class ReleasesNamespace(Namespace):
98
104
  }
99
105
  if license_id is not None:
100
106
  payload["license"] = identifier(license_id)
107
+ if completed_only:
108
+ # Sent only when asked, so every other request body stays as before.
109
+ payload["completed_only"] = True
101
110
  # The long request timeout stays: a backend that predates background
102
111
  # preparation still builds the whole Release inside this POST.
103
112
  raw = self._api.post(
@@ -106,6 +115,14 @@ class ReleasesNamespace(Namespace):
106
115
  timeout=600.0,
107
116
  )
108
117
  release = Release._from_raw(self._client, raw)
118
+ if completed_only and not release.completed_only:
119
+ # An older server drops the unknown field and releases every item;
120
+ # its answer then lacks the echo. Say so rather than hand that back.
121
+ raise UnitlabError(
122
+ "This Unitlab server does not support completed_only releases; "
123
+ f"Release {release.id} was created with every labelled item.",
124
+ code="completed_only_unsupported",
125
+ )
109
126
  return release.wait(timeout=timeout) if wait else release
110
127
 
111
128
 
@@ -124,6 +141,8 @@ class Release:
124
141
  status: str | None = None
125
142
  progress: int | None = None
126
143
  status_error: str | None = None
144
+ # True when the Release holds only items that were Complete.
145
+ completed_only: bool = False
127
146
 
128
147
  @classmethod
129
148
  def _from_raw(cls, client: UnitlabClient, raw: dict[str, Any]) -> Release:
@@ -140,6 +159,7 @@ class Release:
140
159
  status=raw.get("status"),
141
160
  progress=raw.get("progress"),
142
161
  status_error=raw.get("status_error"),
162
+ completed_only=bool(raw.get("completed_only", False)),
143
163
  )
144
164
 
145
165
  def refresh(self) -> Release:
@@ -267,7 +267,7 @@ def test_file_size_limit_and_closed_streams_on_request_failure(
267
267
  project.annotation_imports.create(labels, source_name="model")
268
268
  assert opened and all(stream.closed for stream in opened)
269
269
  monkeypatch.setattr("unitlab.resources.annotation_imports.MAX_FILE_BYTES", 1)
270
- with pytest.raises(ValueError, match="600 MiB"):
270
+ with pytest.raises(ValueError, match="80 MiB"):
271
271
  project.annotation_imports.create(labels, source_name="model")
272
272
  assert len(opened) == 1
273
273
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes