hirundo 0.1.18__tar.gz → 0.1.21__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 (31) hide show
  1. {hirundo-0.1.18 → hirundo-0.1.21}/PKG-INFO +21 -14
  2. {hirundo-0.1.18 → hirundo-0.1.21}/README.md +9 -9
  3. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/__init__.py +12 -8
  4. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_constraints.py +1 -1
  5. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_headers.py +1 -1
  6. hirundo-0.1.21/hirundo/_http.py +72 -0
  7. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_iter_sse_retrying.py +1 -1
  8. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/cli.py +7 -7
  9. hirundo-0.1.18/hirundo/dataset_optimization.py → hirundo-0.1.21/hirundo/dataset_qa.py +149 -108
  10. hirundo-0.1.18/hirundo/dataset_optimization_results.py → hirundo-0.1.21/hirundo/dataset_qa_results.py +4 -4
  11. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/git.py +1 -2
  12. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/storage.py +1 -2
  13. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/unzip.py +9 -10
  14. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/PKG-INFO +21 -14
  15. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/SOURCES.txt +2 -2
  16. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/requires.txt +10 -3
  17. {hirundo-0.1.18 → hirundo-0.1.21}/pyproject.toml +22 -7
  18. hirundo-0.1.18/hirundo/_http.py +0 -19
  19. {hirundo-0.1.18 → hirundo-0.1.21}/LICENSE +0 -0
  20. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/__main__.py +0 -0
  21. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_dataframe.py +0 -0
  22. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_env.py +0 -0
  23. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_timeouts.py +0 -0
  24. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/_urls.py +0 -0
  25. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/dataset_enum.py +0 -0
  26. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/labeling.py +0 -0
  27. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo/logger.py +0 -0
  28. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/dependency_links.txt +0 -0
  29. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/entry_points.txt +0 -0
  30. {hirundo-0.1.18 → hirundo-0.1.21}/hirundo.egg-info/top_level.txt +0 -0
  31. {hirundo-0.1.18 → hirundo-0.1.21}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hirundo
3
- Version: 0.1.18
3
+ Version: 0.1.21
4
4
  Summary: This package is used to interface with Hirundo's platform. It provides a simple API to optimize your ML datasets.
5
5
  Author-email: Hirundo <dev@hirundo.io>
6
6
  License: MIT License
@@ -13,7 +13,7 @@ License: MIT License
13
13
 
14
14
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
15
 
16
- Project-URL: Homepage, https://github.com/Hirundo-io/hirundo-client
16
+ Project-URL: Homepage, https://github.com/Hirundo-io/hirundo-python-sdk
17
17
  Keywords: dataset,machine learning,data science,data engineering
18
18
  Classifier: License :: OSI Approved :: MIT License
19
19
  Classifier: Programming Language :: Python
@@ -32,6 +32,10 @@ Requires-Dist: httpx>=0.27.0
32
32
  Requires-Dist: stamina>=24.2.0
33
33
  Requires-Dist: httpx-sse>=0.4.0
34
34
  Requires-Dist: tqdm>=4.66.5
35
+ Requires-Dist: h11>=0.16.0
36
+ Requires-Dist: requests>=2.32.4
37
+ Requires-Dist: urllib3>=2.5.0
38
+ Requires-Dist: setuptools>=78.1.1
35
39
  Provides-Extra: dev
36
40
  Requires-Dist: pyyaml>=6.0.1; extra == "dev"
37
41
  Requires-Dist: types-PyYAML>=6.0.12; extra == "dev"
@@ -46,13 +50,15 @@ Requires-Dist: stamina>=24.2.0; extra == "dev"
46
50
  Requires-Dist: httpx-sse>=0.4.0; extra == "dev"
47
51
  Requires-Dist: pytest>=8.2.0; extra == "dev"
48
52
  Requires-Dist: pytest-asyncio>=0.23.6; extra == "dev"
49
- Requires-Dist: uv>=0.5.8; extra == "dev"
53
+ Requires-Dist: uv>=0.8.6; extra == "dev"
50
54
  Requires-Dist: pre-commit>=3.7.1; extra == "dev"
51
55
  Requires-Dist: virtualenv>=20.6.6; extra == "dev"
52
- Requires-Dist: ruff>=0.11.6; extra == "dev"
56
+ Requires-Dist: ruff>=0.12.0; extra == "dev"
53
57
  Requires-Dist: bumpver; extra == "dev"
54
58
  Requires-Dist: platformdirs>=4.3.6; extra == "dev"
55
59
  Requires-Dist: safety>=3.2.13; extra == "dev"
60
+ Requires-Dist: cryptography>=44.0.1; extra == "dev"
61
+ Requires-Dist: jinja2>=3.1.6; extra == "dev"
56
62
  Provides-Extra: docs
57
63
  Requires-Dist: sphinx>=7.4.7; extra == "docs"
58
64
  Requires-Dist: sphinx-autobuild>=2024.9.3; extra == "docs"
@@ -61,8 +67,9 @@ Requires-Dist: autodoc_pydantic>=2.2.0; extra == "docs"
61
67
  Requires-Dist: furo; extra == "docs"
62
68
  Requires-Dist: sphinx-multiversion; extra == "docs"
63
69
  Requires-Dist: esbonio; extra == "docs"
64
- Requires-Dist: starlette>0.40.0; extra == "docs"
70
+ Requires-Dist: starlette>=0.47.2; extra == "docs"
65
71
  Requires-Dist: markupsafe>=3.0.2; extra == "docs"
72
+ Requires-Dist: jinja2>=3.1.6; extra == "docs"
66
73
  Provides-Extra: pandas
67
74
  Requires-Dist: pandas>=2.2.3; extra == "pandas"
68
75
  Provides-Extra: polars
@@ -71,9 +78,9 @@ Dynamic: license-file
71
78
 
72
79
  # Hirundo
73
80
 
74
- This package exposes access to Hirundo APIs for dataset optimization for Machine Learning.
81
+ This package exposes access to Hirundo APIs for dataset QA for Machine Learning.
75
82
 
76
- Dataset optimization is currently available for datasets labelled for classification and object detection.
83
+ Dataset QA is currently available for datasets labelled for classification and object detection.
77
84
 
78
85
  Support dataset storage configs include:
79
86
 
@@ -144,7 +151,7 @@ Classification example:
144
151
  from hirundo import (
145
152
  HirundoCSV,
146
153
  LabelingType,
147
- OptimizationDataset,
154
+ QADataset,
148
155
  StorageGCP,
149
156
  StorageConfig,
150
157
  StorageTypes,
@@ -155,7 +162,7 @@ gcp_bucket = StorageGCP(
155
162
  project="Hirundo-global",
156
163
  credentials_json=json.loads(os.environ["GCP_CREDENTIALS"]),
157
164
  )
158
- test_dataset = OptimizationDataset(
165
+ test_dataset = QADataset(
159
166
  name="TEST-GCP cifar 100 classification dataset",
160
167
  labeling_type=LabelingType.SINGLE_LABEL_CLASSIFICATION,
161
168
  storage_config=StorageConfig(
@@ -170,7 +177,7 @@ test_dataset = OptimizationDataset(
170
177
  classes=cifar100_classes,
171
178
  )
172
179
 
173
- test_dataset.run_optimization()
180
+ test_dataset.run_qa()
174
181
  results = test_dataset.check_run()
175
182
  print(results)
176
183
  ```
@@ -182,7 +189,7 @@ from hirundo import (
182
189
  GitRepo,
183
190
  HirundoCSV,
184
191
  LabelingType,
185
- OptimizationDataset,
192
+ QADataset,
186
193
  StorageGit,
187
194
  StorageConfig,
188
195
  StorageTypes,
@@ -195,7 +202,7 @@ git_storage = StorageGit(
195
202
  ),
196
203
  branch="main",
197
204
  )
198
- test_dataset = OptimizationDataset(
205
+ test_dataset = QADataset(
199
206
  name="TEST-HuggingFace-BDD-100k-validation-OD-validation-dataset",
200
207
  labeling_type=LabelingType.OBJECT_DETECTION,
201
208
  storage_config=StorageConfig(
@@ -211,7 +218,7 @@ test_dataset = OptimizationDataset(
211
218
  ),
212
219
  )
213
220
 
214
- test_dataset.run_optimization()
221
+ test_dataset.run_qa()
215
222
  results = test_dataset.check_run()
216
223
  print(results)
217
224
  ```
@@ -220,4 +227,4 @@ Note: Currently we only support the main CPython release 3.9, 3.10, 3.11, 3.12 &
220
227
 
221
228
  ## Further documentation
222
229
 
223
- To learn more about how to use this library, please visit the [http://docs.hirundo.io/](documentation) or see the [Google Colab examples](https://github.com/Hirundo-io/hirundo-client/tree/main/notebooks).
230
+ To learn more about how to use this library, please visit the [http://docs.hirundo.io/](documentation) or see the [Google Colab examples](https://github.com/Hirundo-io/hirundo-python-sdk/tree/main/notebooks).
@@ -1,8 +1,8 @@
1
1
  # Hirundo
2
2
 
3
- This package exposes access to Hirundo APIs for dataset optimization for Machine Learning.
3
+ This package exposes access to Hirundo APIs for dataset QA for Machine Learning.
4
4
 
5
- Dataset optimization is currently available for datasets labelled for classification and object detection.
5
+ Dataset QA is currently available for datasets labelled for classification and object detection.
6
6
 
7
7
  Support dataset storage configs include:
8
8
 
@@ -73,7 +73,7 @@ Classification example:
73
73
  from hirundo import (
74
74
  HirundoCSV,
75
75
  LabelingType,
76
- OptimizationDataset,
76
+ QADataset,
77
77
  StorageGCP,
78
78
  StorageConfig,
79
79
  StorageTypes,
@@ -84,7 +84,7 @@ gcp_bucket = StorageGCP(
84
84
  project="Hirundo-global",
85
85
  credentials_json=json.loads(os.environ["GCP_CREDENTIALS"]),
86
86
  )
87
- test_dataset = OptimizationDataset(
87
+ test_dataset = QADataset(
88
88
  name="TEST-GCP cifar 100 classification dataset",
89
89
  labeling_type=LabelingType.SINGLE_LABEL_CLASSIFICATION,
90
90
  storage_config=StorageConfig(
@@ -99,7 +99,7 @@ test_dataset = OptimizationDataset(
99
99
  classes=cifar100_classes,
100
100
  )
101
101
 
102
- test_dataset.run_optimization()
102
+ test_dataset.run_qa()
103
103
  results = test_dataset.check_run()
104
104
  print(results)
105
105
  ```
@@ -111,7 +111,7 @@ from hirundo import (
111
111
  GitRepo,
112
112
  HirundoCSV,
113
113
  LabelingType,
114
- OptimizationDataset,
114
+ QADataset,
115
115
  StorageGit,
116
116
  StorageConfig,
117
117
  StorageTypes,
@@ -124,7 +124,7 @@ git_storage = StorageGit(
124
124
  ),
125
125
  branch="main",
126
126
  )
127
- test_dataset = OptimizationDataset(
127
+ test_dataset = QADataset(
128
128
  name="TEST-HuggingFace-BDD-100k-validation-OD-validation-dataset",
129
129
  labeling_type=LabelingType.OBJECT_DETECTION,
130
130
  storage_config=StorageConfig(
@@ -140,7 +140,7 @@ test_dataset = OptimizationDataset(
140
140
  ),
141
141
  )
142
142
 
143
- test_dataset.run_optimization()
143
+ test_dataset.run_qa()
144
144
  results = test_dataset.check_run()
145
145
  print(results)
146
146
  ```
@@ -149,4 +149,4 @@ Note: Currently we only support the main CPython release 3.9, 3.10, 3.11, 3.12 &
149
149
 
150
150
  ## Further documentation
151
151
 
152
- To learn more about how to use this library, please visit the [http://docs.hirundo.io/](documentation) or see the [Google Colab examples](https://github.com/Hirundo-io/hirundo-client/tree/main/notebooks).
152
+ To learn more about how to use this library, please visit the [http://docs.hirundo.io/](documentation) or see the [Google Colab examples](https://github.com/Hirundo-io/hirundo-python-sdk/tree/main/notebooks).
@@ -3,13 +3,15 @@ from .dataset_enum import (
3
3
  LabelingType,
4
4
  StorageTypes,
5
5
  )
6
- from .dataset_optimization import (
6
+ from .dataset_qa import (
7
+ ClassificationRunArgs,
8
+ Domain,
7
9
  HirundoError,
8
- OptimizationDataset,
10
+ ObjectDetectionRunArgs,
11
+ QADataset,
9
12
  RunArgs,
10
- VisionRunArgs,
11
13
  )
12
- from .dataset_optimization_results import DatasetOptimizationResults
14
+ from .dataset_qa_results import DatasetQAResults
13
15
  from .git import GitPlainAuth, GitRepo, GitSSHAuth
14
16
  from .labeling import (
15
17
  COCO,
@@ -40,9 +42,11 @@ __all__ = [
40
42
  "KeylabsObjDetVideo",
41
43
  "KeylabsObjSegImages",
42
44
  "KeylabsObjSegVideo",
43
- "OptimizationDataset",
45
+ "QADataset",
46
+ "Domain",
44
47
  "RunArgs",
45
- "VisionRunArgs",
48
+ "ClassificationRunArgs",
49
+ "ObjectDetectionRunArgs",
46
50
  "DatasetMetadataType",
47
51
  "LabelingType",
48
52
  "GitPlainAuth",
@@ -54,9 +58,9 @@ __all__ = [
54
58
  # "StorageAzure", TODO: Azure storage is coming soon
55
59
  "StorageGit",
56
60
  "StorageConfig",
57
- "DatasetOptimizationResults",
61
+ "DatasetQAResults",
58
62
  "load_df",
59
63
  "load_from_zip",
60
64
  ]
61
65
 
62
- __version__ = "0.1.18"
66
+ __version__ = "0.1.21"
@@ -11,7 +11,7 @@ from hirundo.labeling import COCO, YOLO, HirundoCSV, Keylabs
11
11
 
12
12
  if TYPE_CHECKING:
13
13
  from hirundo._urls import HirundoUrl
14
- from hirundo.dataset_optimization import LabelingInfo
14
+ from hirundo.dataset_qa import LabelingInfo
15
15
  from hirundo.storage import (
16
16
  ResponseStorageConfig,
17
17
  StorageConfig,
@@ -1,6 +1,6 @@
1
1
  from hirundo._env import API_KEY, check_api_key
2
2
 
3
- HIRUNDO_API_VERSION = "0.2"
3
+ HIRUNDO_API_VERSION = "0.3"
4
4
 
5
5
  _json_headers = {
6
6
  "Content-Type": "application/json",
@@ -0,0 +1,72 @@
1
+ import requests as _requests
2
+ from requests import Response
3
+ from requests.adapters import HTTPAdapter
4
+ from urllib3.util.retry import Retry
5
+
6
+ import hirundo.logger
7
+
8
+ logger = hirundo.logger.get_logger(__name__)
9
+
10
+ MINIMUM_CLIENT_SERVER_ERROR_CODE = 400
11
+
12
+
13
+ def _build_retrying_session() -> _requests.Session:
14
+ # No more than 10 tries total (including the initial attempt)
15
+ # urllib3 Retry.total counts retries, not total attempts, so use 9 retries
16
+ retries = Retry(
17
+ total=9,
18
+ backoff_factor=1.0,
19
+ status_forcelist=(429,),
20
+ allowed_methods=("HEAD", "GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"),
21
+ respect_retry_after_header=True,
22
+ raise_on_status=False,
23
+ )
24
+ adapter = HTTPAdapter(max_retries=retries)
25
+ session = _requests.Session()
26
+ session.mount("http://", adapter)
27
+ session.mount("https://", adapter)
28
+ return session
29
+
30
+
31
+ _SESSION = _build_retrying_session()
32
+
33
+
34
+ class _RequestsShim:
35
+ """Shim exposing a subset of the requests API but backed by a retrying Session."""
36
+
37
+ HTTPError = _requests.HTTPError
38
+ Response = _requests.Response
39
+
40
+ def request(self, method: str, url: str, **kwargs) -> Response:
41
+ return _SESSION.request(method=method, url=url, **kwargs)
42
+
43
+ def get(self, url: str, **kwargs) -> Response:
44
+ return _SESSION.get(url, **kwargs)
45
+
46
+ def post(self, url: str, **kwargs) -> Response:
47
+ return _SESSION.post(url, **kwargs)
48
+
49
+ def delete(self, url: str, **kwargs) -> Response:
50
+ return _SESSION.delete(url, **kwargs)
51
+
52
+ def patch(self, url: str, **kwargs) -> Response:
53
+ return _SESSION.patch(url, **kwargs)
54
+
55
+ def put(self, url: str, **kwargs) -> Response:
56
+ return _SESSION.put(url, **kwargs)
57
+
58
+
59
+ # Public shim to be imported by modules instead of the raw requests package
60
+ requests = _RequestsShim()
61
+
62
+
63
+ def raise_for_status_with_reason(response: Response):
64
+ try:
65
+ if response.status_code >= MINIMUM_CLIENT_SERVER_ERROR_CODE:
66
+ response.reason = response.json().get("reason", None)
67
+ if response.reason is None:
68
+ response.reason = response.json().get("detail", None)
69
+ except Exception as e:
70
+ logger.debug("Could not parse response as JSON: %s", e)
71
+
72
+ response.raise_for_status()
@@ -5,11 +5,11 @@ import uuid
5
5
  from collections.abc import AsyncGenerator, Generator
6
6
 
7
7
  import httpx
8
- import requests
9
8
  import urllib3
10
9
  from httpx_sse import ServerSentEvent, SSEError, aconnect_sse, connect_sse
11
10
  from stamina import retry
12
11
 
12
+ from hirundo._http import requests
13
13
  from hirundo._timeouts import READ_TIMEOUT
14
14
  from hirundo.logger import get_logger
15
15
 
@@ -88,7 +88,7 @@ def setup_api_key(
88
88
  ],
89
89
  ):
90
90
  """
91
- Setup the API key for the Hirundo client library.
91
+ Setup the API key for the Hirundo Python SDK.
92
92
  Values are saved to a .env file in the current directory for use by the library in requests.
93
93
  """
94
94
  saved_to = upsert_env("API_KEY", api_key)
@@ -115,7 +115,7 @@ def change_api_remote(
115
115
  ],
116
116
  ):
117
117
  """
118
- Change the API server address for the Hirundo client library.
118
+ Change the API server address for the Hirundo Python SDK.
119
119
  This is the same address where you access the Hirundo web interface.
120
120
  """
121
121
  api_host = fix_api_host(api_host)
@@ -151,7 +151,7 @@ def setup(
151
151
  ],
152
152
  ):
153
153
  """
154
- Setup the Hirundo client library.
154
+ Setup the Hirundo Python SDK.
155
155
  """
156
156
  api_host = fix_api_host(api_host)
157
157
  api_host_saved_to = upsert_env("API_HOST", api_host)
@@ -198,9 +198,9 @@ def check_run(
198
198
  """
199
199
  Check the status of a run.
200
200
  """
201
- from hirundo.dataset_optimization import OptimizationDataset
201
+ from hirundo.dataset_qa import QADataset
202
202
 
203
- results = OptimizationDataset.check_run_by_id(run_id)
203
+ results = QADataset.check_run_by_id(run_id)
204
204
  print(f"Run results saved to {results.cached_zip_path}")
205
205
 
206
206
 
@@ -209,9 +209,9 @@ def list_runs():
209
209
  """
210
210
  List all runs available.
211
211
  """
212
- from hirundo.dataset_optimization import OptimizationDataset
212
+ from hirundo.dataset_qa import QADataset
213
213
 
214
- runs = OptimizationDataset.list_runs()
214
+ runs = QADataset.list_runs()
215
215
 
216
216
  console = Console()
217
217
  table = Table(