sima-cli 0.0.40__py3-none-any.whl → 0.0.41__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.
sima_cli/__version__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # sima_cli/__version__.py
2
- __version__ = "0.0.40"
2
+ __version__ = "0.0.41"
@@ -340,30 +340,29 @@ def docker_login_with_token(username: str, token: str, registry: str = "artifact
340
340
  - Ensures Docker is available before attempting login.
341
341
  - Works even when Docker uses credential helpers (e.g., credsStore=desktop).
342
342
  """
343
- ensure_docker_available()
344
-
345
- # Decode if token looks like base64 (AWS ECR style)
346
- try:
347
- decoded = base64.b64decode(token).decode("utf-8")
348
- if decoded.startswith("AWS:"):
349
- # ECR token detected → force username to AWS
350
- password = decoded.split("AWS:", 1)[1]
351
- username = "AWS"
352
- else:
343
+ if ensure_docker_available():
344
+ # Decode if token looks like base64 (AWS ECR style)
345
+ try:
346
+ decoded = base64.b64decode(token).decode("utf-8")
347
+ if decoded.startswith("AWS:"):
348
+ # ECR token detected → force username to AWS
349
+ password = decoded.split("AWS:", 1)[1]
350
+ username = "AWS"
351
+ else:
352
+ password = token
353
+ except Exception:
354
+ # Not a valid base64 string — use raw token
353
355
  password = token
354
- except Exception:
355
- # Not a valid base64 string — use raw token
356
- password = token
357
-
358
- proc = subprocess.run(
359
- ["docker", "login", registry, "-u", username, "--password-stdin"],
360
- input=password.encode(),
361
- stdout=subprocess.PIPE,
362
- stderr=subprocess.PIPE,
363
- )
364
-
365
- if proc.returncode != 0:
366
- raise click.ClickException(f"❌ Docker login failed: {proc.stderr.decode().strip()}")
367
-
368
- click.echo(proc.stdout.decode().strip() or f"✅ Logged in to SiMa.ai container registry")
369
- return password
356
+
357
+ proc = subprocess.run(
358
+ ["docker", "login", registry, "-u", username, "--password-stdin"],
359
+ input=password.encode(),
360
+ stdout=subprocess.PIPE,
361
+ stderr=subprocess.PIPE,
362
+ )
363
+
364
+ if proc.returncode != 0:
365
+ raise click.ClickException(f"❌ Docker login failed: {proc.stderr.decode().strip()}")
366
+
367
+ click.echo(proc.stdout.decode().strip() or f"✅ Logged in to SiMa.ai container registry")
368
+ return password
sima_cli/update/remote.py CHANGED
@@ -117,18 +117,31 @@ def get_remote_board_info(ip: str, passwd: str = DEFAULT_PASSWORD) -> Tuple[str,
117
117
  return "", "", "", False, ""
118
118
 
119
119
  def _scp_file(sftp, local_path: str, remote_path: str):
120
- """Upload file via SFTP with tqdm progress bar."""
121
- filename = os.path.basename(local_path)
122
- total_size = os.path.getsize(local_path)
120
+ """Upload file via SFTP with tqdm block progress bar (Windows-safe)."""
123
121
 
124
122
  from tqdm import tqdm
125
123
 
126
- with tqdm(total=total_size, unit='B', unit_scale=True,
127
- desc=f"📤 {filename}", ascii=True) as pbar:
124
+ filename = os.path.basename(local_path)
125
+ total_size = os.path.getsize(local_path)
126
+
127
+ # Normalize paths
128
+ local_path = os.path.abspath(local_path)
129
+ remote_path = remote_path.replace("\\", "/")
130
+
131
+ # Use Unicode blocks instead of hashes
132
+ with tqdm(
133
+ total=total_size,
134
+ unit="B",
135
+ unit_scale=True,
136
+ desc=f"📤 {filename}",
137
+ bar_format="{l_bar}{bar} | {n_fmt}/{total_fmt}",
138
+ ) as pbar:
128
139
  def progress(transferred, total):
129
140
  pbar.update(transferred - pbar.n)
130
141
 
131
- sftp.put(local_path, remote_path, callback=progress)
142
+ # Open explicitly to avoid Windows file lock issues
143
+ with open(local_path, "rb") as f:
144
+ sftp.putfo(f, remote_path, callback=progress)
132
145
 
133
146
  click.echo("✅ Upload complete")
134
147
 
@@ -8,11 +8,10 @@ def _pull_container_from_registry(registry_url: str, image_ref: str) -> str:
8
8
  """
9
9
  Pulls container image from given registry and returns its local reference.
10
10
  """
11
- ensure_docker_available()
12
- full_image = f"{registry_url.rstrip('/')}/{image_ref}"
13
- subprocess.run(["docker", "pull", full_image], check=True)
14
- return full_image
15
-
11
+ if ensure_docker_available():
12
+ full_image = f"{registry_url.rstrip('/')}/{image_ref}"
13
+ subprocess.run(["docker", "pull", full_image], check=True)
14
+ return full_image
16
15
 
17
16
  def docker_logout_from_registry(registry: str = "artifacts.eng.sima.ai"):
18
17
  """
@@ -20,27 +19,27 @@ def docker_logout_from_registry(registry: str = "artifacts.eng.sima.ai"):
20
19
  Removes stored credentials (even if managed by a credential helper).
21
20
  Safe to call multiple times — no error if already logged out.
22
21
  """
23
- ensure_docker_available()
24
- click.echo(f"🐳 Logging out of Docker registry")
22
+ if ensure_docker_available():
23
+ click.echo(f"🐳 Logging out of Docker registry")
25
24
 
26
- try:
27
- proc = subprocess.run(
28
- ["docker", "logout", registry],
29
- stdout=subprocess.PIPE,
30
- stderr=subprocess.PIPE,
31
- )
25
+ try:
26
+ proc = subprocess.run(
27
+ ["docker", "logout", registry],
28
+ stdout=subprocess.PIPE,
29
+ stderr=subprocess.PIPE,
30
+ )
32
31
 
33
- if proc.returncode == 0:
34
- click.echo(proc.stdout.decode().strip() or f"✅ Logged out from {registry}")
35
- else:
36
- msg = proc.stderr.decode().strip() or proc.stdout.decode().strip()
37
- if "not logged in" in msg.lower():
38
- click.echo(f"ℹ️ Already logged out from {registry}")
32
+ if proc.returncode == 0:
33
+ click.echo(proc.stdout.decode().strip() or f"✅ Logged out from {registry}")
39
34
  else:
40
- raise click.ClickException(f"Docker logout failed: {msg}")
35
+ msg = proc.stderr.decode().strip() or proc.stdout.decode().strip()
36
+ if "not logged in" in msg.lower():
37
+ click.echo(f"ℹ️ Already logged out from {registry}")
38
+ else:
39
+ raise click.ClickException(f"Docker logout failed: {msg}")
41
40
 
42
- except Exception as e:
43
- raise click.ClickException(f"⚠️ Unexpected error during Docker logout: {e}")
41
+ except Exception as e:
42
+ raise click.ClickException(f"⚠️ Unexpected error during Docker logout: {e}")
44
43
 
45
44
 
46
45
  def _select_artifactory_version(image_name: str) -> str:
@@ -166,7 +165,10 @@ def install_from_cr(resource_spec: str, internal: bool = False) -> str:
166
165
  pulled_ref = _pull_container_from_registry(
167
166
  registry_url, f"{image_name}{separator}{version or 'latest'}"
168
167
  )
169
- click.echo(f"✅ Successfully pulled container: {pulled_ref}")
168
+
169
+ if pulled_ref:
170
+ click.echo(f"✅ Successfully pulled container: {pulled_ref}")
171
+
170
172
  except subprocess.CalledProcessError as e:
171
173
  raise click.ClickException(f"❌ Docker pull failed: {e}")
172
174
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sima-cli
3
- Version: 0.0.40
3
+ Version: 0.0.41
4
4
  Summary: CLI tool for SiMa Developer Portal to download models, firmware, and apps.
5
5
  Home-page: https://developer.sima.ai/
6
6
  Author: SiMa.ai
@@ -1,11 +1,11 @@
1
1
  sima_cli/__init__.py,sha256=Nb2jSg9-CX1XvSc1c21U9qQ3atINxphuNkNfmR-9P3o,332
2
2
  sima_cli/__main__.py,sha256=ehzD6AZ7zGytC2gLSvaJatxeD0jJdaEvNJvwYeGsWOg,69
3
- sima_cli/__version__.py,sha256=PggPNN98qAKN0lJrYRuU2O1ULuwqDoUsrM7NUyq1sBw,49
3
+ sima_cli/__version__.py,sha256=8KtaNfFFX0nxPr6o3A1s7VLJFBSr62xYftsognG1ItU,49
4
4
  sima_cli/cli.py,sha256=hE2NJfpBo5dDH_D9qQgvbn63Xw6R0i5uWluIkXrw2yg,19946
5
5
  sima_cli/app_zoo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  sima_cli/app_zoo/app.py,sha256=6u3iIqVZkuMK49kK0f3dVJCCf5-qC-xzLOS78-TkeN8,15738
7
7
  sima_cli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- sima_cli/auth/basic_auth.py,sha256=nW-Q9y4dZTgq7FYuCwcUZstQT7rq-H-PJOolW1yo_lw,14212
8
+ sima_cli/auth/basic_auth.py,sha256=Xvi8D1xCNEw7KGfLCXzV5QeiQi0v13056beA514ARVA,14303
9
9
  sima_cli/auth/login.py,sha256=7le0had8uW-v__aEL1gl_bL9DZKJLxZmEoVI86YNmFo,2862
10
10
  sima_cli/data/resources_internal.yaml,sha256=zlQD4cSnZK86bLtTWuvEudZTARKiuIKmB--Jv4ajL8o,200
11
11
  sima_cli/data/resources_public.yaml,sha256=U7hmUomGeQ2ULdo1BU2OQHr0PyKBamIdK9qrutDlX8o,201
@@ -36,19 +36,19 @@ sima_cli/update/elxr.py,sha256=3mMKeu9AWi3zGY8q2bkJFQOVyacSrPXdKBJFre_BLcE,2776
36
36
  sima_cli/update/local.py,sha256=8HK5j-5HEOC0nPWKkcPPnAxB3Ai8QpH3hGyucN0izXY,5698
37
37
  sima_cli/update/netboot.py,sha256=gHu3Ts23Vlbvcn9dZ2u0KckP8y4WSmlzZCYWBiRsrmQ,20447
38
38
  sima_cli/update/query.py,sha256=aqBeVYOTmy3gBVaxfK2c5f6_DH8_y32ZEB1INiJbOE8,5034
39
- sima_cli/update/remote.py,sha256=ppxKGz8qBZ7rU_XEdXi6ouxmpidNx-5S9CNmAqrBpfU,15595
39
+ sima_cli/update/remote.py,sha256=kAIJEuaH-ULV_RQwbeNgbA8pFKupunVcw1sAYJQt7z4,15946
40
40
  sima_cli/update/updater.py,sha256=Xhmpo41USPZMok8KwTEvYU6BIWv49kYC3zs_ls1LRrg,26325
41
41
  sima_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  sima_cli/utils/artifactory.py,sha256=6YyVpzVm8ATy7NEwT9nkWx-wptkXrvG7Wl_zDT6jmLs,2390
43
43
  sima_cli/utils/config.py,sha256=wE-cPQqY_gOqaP8t01xsRHD9tBUGk9MgBUm2GYYxI3E,1616
44
44
  sima_cli/utils/config_loader.py,sha256=7I5we1yiCai18j9R9jvhfUzAmT3OjAqVK35XSLuUw8c,2005
45
- sima_cli/utils/container_registries.py,sha256=hGS9cRVunzPRsktspaj3AnilFhcoGvimpcfvfg-bLS8,6341
45
+ sima_cli/utils/container_registries.py,sha256=KIvU5bbYBZlD-XMaGKQznGHMbzaBKtBmapfB52AmS7M,6461
46
46
  sima_cli/utils/disk.py,sha256=66Kr631yhc_ny19up2aijfycWfD35AeLQOJgUsuH2hY,446
47
47
  sima_cli/utils/env.py,sha256=0qY1-PJiI1G3uDVv774aimPXhHQBtY56FqXSMeMQTps,10401
48
48
  sima_cli/utils/net.py,sha256=WVntA4CqipkNrrkA4tBVRadJft_pMcGYh4Re5xk3rqo,971
49
49
  sima_cli/utils/network.py,sha256=UvqxbqbWUczGFyO-t1SybG7Q-x9kjUVRNIn_D6APzy8,1252
50
50
  sima_cli/utils/pkg_update_check.py,sha256=GD0XVS2_l2WpuzL81TKkEQIDHXXffJeF3LELefncHNM,3467
51
- sima_cli-0.0.40.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
51
+ sima_cli-0.0.41.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
52
52
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  tests/test_app_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  tests/test_auth.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -57,8 +57,8 @@ tests/test_download.py,sha256=t87DwxlHs26_ws9rpcHGwr_OrcRPd3hz6Zmm0vRee2U,4465
57
57
  tests/test_firmware.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  tests/test_model_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- sima_cli-0.0.40.dist-info/METADATA,sha256=X2jDLmN4ELyJ0HPPTAlnEiALlaB_OgrI_jS_COv5zM0,3705
61
- sima_cli-0.0.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
- sima_cli-0.0.40.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
63
- sima_cli-0.0.40.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
64
- sima_cli-0.0.40.dist-info/RECORD,,
60
+ sima_cli-0.0.41.dist-info/METADATA,sha256=-RebJI2aFDR32sgg_LwSLajM9auXryr2XpCXV09lEaE,3705
61
+ sima_cli-0.0.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
+ sima_cli-0.0.41.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
63
+ sima_cli-0.0.41.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
64
+ sima_cli-0.0.41.dist-info/RECORD,,