supervisely 6.73.248__py3-none-any.whl → 6.73.250__py3-none-any.whl

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.

Potentially problematic release.


This version of supervisely might be problematic. Click here for more details.

supervisely/api/api.py CHANGED
@@ -1011,6 +1011,7 @@ class Api:
1011
1011
  headers: Optional[Dict[str, str]] = None,
1012
1012
  retries: Optional[int] = None,
1013
1013
  raise_error: Optional[bool] = False,
1014
+ timeout: httpx._types.TimeoutTypes = 60,
1014
1015
  ) -> httpx.Response:
1015
1016
  """
1016
1017
  Performs POST request to server with given parameters using httpx.
@@ -1031,6 +1032,8 @@ class Api:
1031
1032
  :type retries: int, optional
1032
1033
  :param raise_error: Define, if you'd like to raise error if connection is failed.
1033
1034
  :type raise_error: bool, optional
1035
+ :param timeout: Overall timeout for the request.
1036
+ :type timeout: float, optional
1034
1037
  :return: Response object
1035
1038
  :rtype: :class:`httpx.Response`
1036
1039
  """
@@ -1057,6 +1060,7 @@ class Api:
1057
1060
  json=json,
1058
1061
  params=params,
1059
1062
  headers=headers,
1063
+ timeout=timeout,
1060
1064
  )
1061
1065
  if response.status_code != httpx.codes.OK:
1062
1066
  self._check_version()
@@ -1098,6 +1102,7 @@ class Api:
1098
1102
  params: httpx._types.QueryParamTypes,
1099
1103
  retries: Optional[int] = None,
1100
1104
  use_public_api: Optional[bool] = True,
1105
+ timeout: httpx._types.TimeoutTypes = 60,
1101
1106
  ) -> httpx.Response:
1102
1107
  """
1103
1108
  Performs GET request to server with given parameters.
@@ -1110,6 +1115,8 @@ class Api:
1110
1115
  :type retries: int, optional
1111
1116
  :param use_public_api: Define if public API should be used. Default is True.
1112
1117
  :type use_public_api: bool, optional
1118
+ :param timeout: Overall timeout for the request.
1119
+ :type timeout: float, optional
1113
1120
  :return: Response object
1114
1121
  :rtype: :class:`Response<Response>`
1115
1122
  """
@@ -1131,7 +1138,12 @@ class Api:
1131
1138
  for retry_idx in range(retries):
1132
1139
  response = None
1133
1140
  try:
1134
- response = self.httpx_client.get(url, params=request_params, headers=self.headers)
1141
+ response = self.httpx_client.get(
1142
+ url,
1143
+ params=request_params,
1144
+ headers=self.headers,
1145
+ timeout=timeout,
1146
+ )
1135
1147
  if response.status_code != httpx.codes.OK:
1136
1148
  Api._raise_for_status_httpx(response)
1137
1149
  return response
@@ -1170,7 +1182,7 @@ class Api:
1170
1182
  raise_error: Optional[bool] = False,
1171
1183
  chunk_size: int = 8192,
1172
1184
  use_public_api: Optional[bool] = True,
1173
- timeout: httpx._types.TimeoutTypes = 15,
1185
+ timeout: httpx._types.TimeoutTypes = 60,
1174
1186
  ) -> Generator:
1175
1187
  """
1176
1188
  Performs streaming GET or POST request to server with given parameters.
@@ -1325,6 +1337,7 @@ class Api:
1325
1337
  headers: Optional[Dict[str, str]] = None,
1326
1338
  retries: Optional[int] = None,
1327
1339
  raise_error: Optional[bool] = False,
1340
+ timeout: httpx._types.TimeoutTypes = 60,
1328
1341
  ) -> httpx.Response:
1329
1342
  """
1330
1343
  Performs POST request to server with given parameters using httpx.
@@ -1345,6 +1358,8 @@ class Api:
1345
1358
  :type retries: int, optional
1346
1359
  :param raise_error: Define, if you'd like to raise error if connection is failed.
1347
1360
  :type raise_error: bool, optional
1361
+ :param timeout: Overall timeout for the request.
1362
+ :type timeout: float, optional
1348
1363
  :return: Response object
1349
1364
  :rtype: :class:`httpx.Response`
1350
1365
  """
@@ -1371,6 +1386,7 @@ class Api:
1371
1386
  json=json,
1372
1387
  params=params,
1373
1388
  headers=headers,
1389
+ timeout=timeout,
1374
1390
  )
1375
1391
  if response.status_code != httpx.codes.OK:
1376
1392
  self._check_version()
@@ -1417,7 +1433,7 @@ class Api:
1417
1433
  range_end: Optional[int] = None,
1418
1434
  chunk_size: int = 8192,
1419
1435
  use_public_api: Optional[bool] = True,
1420
- timeout: httpx._types.TimeoutTypes = 15,
1436
+ timeout: httpx._types.TimeoutTypes = 60,
1421
1437
  ) -> AsyncGenerator:
1422
1438
  """
1423
1439
  Performs asynchronous streaming GET or POST request to server with given parameters.
@@ -1,18 +1,19 @@
1
+ import datetime
1
2
  import json
2
3
  import os
3
4
  import random
4
5
  import re
5
- import string
6
- import datetime
7
6
  import shutil
8
- import tarfile
9
- import requests
7
+ import string
10
8
  import subprocess
9
+ import tarfile
11
10
  from pathlib import Path
11
+
12
12
  import git
13
+ import requests
14
+ from giturlparse import parse
13
15
  from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
14
16
  from tqdm import tqdm
15
- from giturlparse import parse
16
17
 
17
18
 
18
19
  def slug_is_valid(slug):
@@ -90,9 +91,7 @@ def get_instance_version(token, server):
90
91
  "x-api-key": token,
91
92
  "Content-Type": "application/json",
92
93
  }
93
- r = requests.post(
94
- f'{server.rstrip("/")}/public/api/v3/instance.version', headers=headers
95
- )
94
+ r = requests.post(f'{server.rstrip("/")}/public/api/v3/instance.version', headers=headers)
96
95
  if r.status_code == 403:
97
96
  raise PermissionError()
98
97
  if r.status_code == 404:
@@ -139,6 +138,7 @@ def upload_archive(
139
138
  share_app,
140
139
  ):
141
140
  f = open(archive_path, "rb")
141
+ archive_name = os.path.basename(archive_path)
142
142
  fields = {
143
143
  "appKey": appKey,
144
144
  "subAppPath": subapp_path,
@@ -147,9 +147,9 @@ def upload_archive(
147
147
  "readme": readme,
148
148
  "modalTemplate": modal_template,
149
149
  "archive": (
150
- "arhcive.tar.gz",
150
+ archive_name,
151
151
  f,
152
- "application/gzip",
152
+ "application/gzip" if archive_name.endswith(".tar.gz") else "application/x-tar",
153
153
  ),
154
154
  }
155
155
  if slug:
@@ -166,9 +166,7 @@ def upload_archive(
166
166
  unit_scale=True,
167
167
  unit_divisor=1024,
168
168
  ) as bar:
169
- m = MultipartEncoderMonitor(
170
- e, lambda monitor: bar.update(monitor.bytes_read - bar.n)
171
- )
169
+ m = MultipartEncoderMonitor(e, lambda monitor: bar.update(monitor.bytes_read - bar.n))
172
170
  response = requests.post(
173
171
  f"{server_address.rstrip('/')}/public/api/v3/ecosystem.release",
174
172
  data=m,
@@ -194,14 +192,20 @@ def archive_application(repo: git.Repo, config, slug):
194
192
  app_folder_name = re.sub("[ \/]", "-", app_folder_name)
195
193
  app_folder_name = re.sub("[\"'`,\[\]\(\)]", "", app_folder_name)
196
194
  working_dir_path = Path(repo.working_dir).absolute()
197
- with tarfile.open(archive_folder + "/archive.tar.gz", "w:gz") as tar:
195
+ if config.get("type", "app") == "client_side_app":
196
+ archive_path = archive_folder + "/archive.tar"
197
+ write_mode = "w"
198
+ else:
199
+ archive_path = archive_folder + "/archive.tar.gz"
200
+ write_mode = "w:gz"
201
+ with tarfile.open(archive_path, write_mode) as tar:
198
202
  for path in file_paths:
199
203
  if path.is_file():
200
204
  tar.add(
201
205
  path.absolute(),
202
206
  Path(app_folder_name).joinpath(path.relative_to(working_dir_path)),
203
207
  )
204
- return archive_folder
208
+ return archive_path
205
209
 
206
210
 
207
211
  def get_user(server_address, api_token):
@@ -209,9 +213,7 @@ def get_user(server_address, api_token):
209
213
  "x-api-key": api_token,
210
214
  "Content-Type": "application/json",
211
215
  }
212
- r = requests.post(
213
- f'{server_address.rstrip("/")}/public/api/v3/users.me', headers=headers
214
- )
216
+ r = requests.post(f'{server_address.rstrip("/")}/public/api/v3/users.me', headers=headers)
215
217
  if r.status_code == 403:
216
218
  raise PermissionError()
217
219
  if r.status_code == 404 or r.status_code == 400:
@@ -256,7 +258,7 @@ def release(
256
258
  ):
257
259
  if created_at is None:
258
260
  created_at = get_created_at(repo, release_version)
259
- archive_dir = archive_application(repo, config, slug)
261
+ archive_path = archive_application(repo, config, slug)
260
262
  release = {
261
263
  "name": release_name,
262
264
  "version": release_version,
@@ -265,7 +267,7 @@ def release(
265
267
  release["createdAt"] = created_at
266
268
  try:
267
269
  response = upload_archive(
268
- archive_dir + "/archive.tar.gz",
270
+ archive_path,
269
271
  server_address,
270
272
  api_token,
271
273
  appKey,
@@ -279,5 +281,5 @@ def release(
279
281
  share_app,
280
282
  )
281
283
  finally:
282
- delete_directory(archive_dir)
284
+ delete_directory(os.path.dirname(archive_path))
283
285
  return response
@@ -4605,6 +4605,9 @@ async def _download_project_item_async(
4605
4605
  Uses parameters from the parent function _download_project_async.
4606
4606
  """
4607
4607
  if save_images:
4608
+ logger.debug(
4609
+ f"Downloading 1 image in single mode: {img_info.name} with _download_project_item_async"
4610
+ )
4608
4611
  img_bytes = await api.image.download_bytes_single_async(
4609
4612
  img_info.id, semaphore=semaphore, check_hash=True
4610
4613
  )
@@ -4667,6 +4670,9 @@ async def _download_project_items_batch_async(
4667
4670
  img_ids = [img_info.id for img_info in img_infos]
4668
4671
  imgs_bytes = [None] * len(img_ids)
4669
4672
  temp_dict = {}
4673
+ logger.debug(
4674
+ f"Downloading {len(img_ids)} images in bulk with _download_project_items_batch_async"
4675
+ )
4670
4676
  async for img_id, img_bytes in api.image.download_bytes_generator_async(
4671
4677
  dataset_id,
4672
4678
  img_ids,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.248
3
+ Version: 6.73.250
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -22,7 +22,7 @@ supervisely/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  supervisely/api/advanced_api.py,sha256=Nd5cCnHFWc3PSUrCtENxTGtDjS37_lCHXsgXvUI3Ti8,2054
23
23
  supervisely/api/agent_api.py,sha256=ShWAIlXcWXcyI9fqVuP5GZVCigCMJmjnvdGUfLspD6Y,8890
24
24
  supervisely/api/annotation_api.py,sha256=kB9l0NhQEkunGDC9fWjNzf5DdhqRF1tv-RRnIbkV2k0,64941
25
- supervisely/api/api.py,sha256=aSFD2Q05q0CK9nmMyFTEv5pHKyTm_ysu9cagwt4GDhs,64746
25
+ supervisely/api/api.py,sha256=A4EY7MtLWw4a29Wd63SjQs2CkS3KAiYkVLyuuZn1LdM,65371
26
26
  supervisely/api/app_api.py,sha256=-T4sISQ7POyR2yirf1kEWj4JaJFpJxCyRWqbf_99Jak,67036
27
27
  supervisely/api/dataset_api.py,sha256=2-SQBlgEnIN-0uvDbtPlSXr6ztBeZ3WPryhkOtpBmk4,40786
28
28
  supervisely/api/file_api.py,sha256=c4iIzH2BF8-GLFLk_wc9Qz225AbHhbzH22wv5HdsGg4,83128
@@ -546,7 +546,7 @@ supervisely/cli/project/project_download.py,sha256=dEznxE_MhLTYbU9KBbdmw-Ria1Knh
546
546
  supervisely/cli/project/project_get.py,sha256=RWnMxuKd_WWhUlA5QEqI_9d4N6x8VDq0taPTWB8nxXc,689
547
547
  supervisely/cli/project/project_upload.py,sha256=qA_0ktOpJxUUa_Hliwvny8-uIYDQBiuzHMq8nufbLd4,1416
548
548
  supervisely/cli/release/__init__.py,sha256=5aDijgIIDsKFZVayq8anvv5ynWKhC4LZqAdESTKCW2c,335
549
- supervisely/cli/release/release.py,sha256=rnCGTbxZ0KhBR8Xc_cdr8KtzI5v28VggbJCiqfBNw7I,7572
549
+ supervisely/cli/release/release.py,sha256=OQEcc9fABWYBzuLc-69jNprtbGsD3QRfxFV3inH_krY,7841
550
550
  supervisely/cli/release/run.py,sha256=z6jDTVweCnlaIWsdUIN282B_JUqYZefJMIPLZnq2g9U,19899
551
551
  supervisely/cli/task/__init__.py,sha256=n0ofJDqX3AMvvTz1umfBDfEUPDFzk5Htve3nnZFd7fs,67
552
552
  supervisely/cli/task/task_set.py,sha256=KIGJ-X0iB7DzX3Ig8720FJh1WpohTVkkPk8HZt2rIzM,1337
@@ -979,7 +979,7 @@ supervisely/project/data_version.py,sha256=nknaWJSUCwoDyNG9_d1KA-GjzidhV9zd9Cn8c
979
979
  supervisely/project/download.py,sha256=zb8sb4XZ6Qi3CP7fmtLRUAYzaxs_W0WnOfe2x3ZVRMs,24639
980
980
  supervisely/project/pointcloud_episode_project.py,sha256=fcaFAaHVn_VvdiIfHl4IyEFE5-Q3VFGfo7_YoxEma0I,41341
981
981
  supervisely/project/pointcloud_project.py,sha256=Y8Xhi6Hg-KyztwFncezuDfKTt2FILss96EU_LdXzmrA,49172
982
- supervisely/project/project.py,sha256=UY7nLGRNcUO6nDvBlirsUg0mbX6XW7_tXoqGaofojqo,188125
982
+ supervisely/project/project.py,sha256=Bnp-LHrlQCxOWV7SVbpEcDKdFO9VMKiAgod6Fld8p-E,188388
983
983
  supervisely/project/project_meta.py,sha256=26s8IiHC5Pg8B1AQi6_CrsWteioJP2in00cRNe8QlW0,51423
984
984
  supervisely/project/project_settings.py,sha256=NLThzU_DCynOK6hkHhVdFyezwprn9UqlnrLDe_3qhkY,9347
985
985
  supervisely/project/project_type.py,sha256=_3RqW2CnDBKFOvSIrQT1RJQaiHirs34_jiQS8CkwCpo,530
@@ -1041,9 +1041,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1041
1041
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1042
1042
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1043
1043
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1044
- supervisely-6.73.248.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1045
- supervisely-6.73.248.dist-info/METADATA,sha256=0R4I5m8-EAFFV8m29WqXyaj3kbtRi5O8AbRa3OeyCpI,33351
1046
- supervisely-6.73.248.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1047
- supervisely-6.73.248.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1048
- supervisely-6.73.248.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1049
- supervisely-6.73.248.dist-info/RECORD,,
1044
+ supervisely-6.73.250.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1045
+ supervisely-6.73.250.dist-info/METADATA,sha256=j3RVqFtC97ky9SHc1RUfxOgYOsbjiW4Fw2SAtAcI_6s,33351
1046
+ supervisely-6.73.250.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1047
+ supervisely-6.73.250.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1048
+ supervisely-6.73.250.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1049
+ supervisely-6.73.250.dist-info/RECORD,,