supervisely 6.73.248__py3-none-any.whl → 6.73.249__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.

@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.248
3
+ Version: 6.73.249
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -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
@@ -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.249.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1045
+ supervisely-6.73.249.dist-info/METADATA,sha256=FBoF2tXmhzf_EnSJp7NDXFSo33Wo4Tu-oTMHcdxBA94,33351
1046
+ supervisely-6.73.249.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1047
+ supervisely-6.73.249.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1048
+ supervisely-6.73.249.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1049
+ supervisely-6.73.249.dist-info/RECORD,,