sima-cli 0.0.11__py3-none-any.whl → 0.0.13__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.11"
2
+ __version__ = "0.0.13"
sima_cli/auth/login.py CHANGED
@@ -31,8 +31,10 @@ def login_internal():
31
31
  cfg = load_resource_config()
32
32
  auth_cfg = cfg.get("internal", {}).get("auth", {})
33
33
  base_url = cfg.get("internal", {}).get("artifactory", {}).get("url", {})
34
- validate_url = f"{base_url}/{auth_cfg.get("validate_url")}"
35
- exchange_url = f"{base_url}/{auth_cfg.get("internal_url")}"
34
+ validate_url = auth_cfg.get("validate_url")
35
+ internal_url = auth_cfg.get("internal_url")
36
+ validate_url = f"{base_url}/{validate_url}"
37
+ exchange_url = f"{base_url}/{internal_url}"
36
38
 
37
39
  # Check for required config values
38
40
  if not validate_url or not exchange_url:
sima_cli/cli.py CHANGED
@@ -3,6 +3,7 @@ import click
3
3
  from sima_cli.utils.env import get_environment_type
4
4
  from sima_cli.update.updater import perform_update
5
5
  from sima_cli.model_zoo.model import list_models, download_model
6
+ from sima_cli.utils.config_loader import internal_resource_exists
6
7
 
7
8
  # Entry point for the CLI tool using Click's command group decorator
8
9
  @click.group()
@@ -21,6 +22,11 @@ def main(ctx, internal):
21
22
  if not internal:
22
23
  internal = os.getenv("SIMA_CLI_INTERNAL", "0") in ("1", "true", "yes")
23
24
 
25
+ if internal and not internal_resource_exists():
26
+ click.echo("❌ You have specified -i or --internal argument to access internal resources, but you do not have an internal resource map configured.")
27
+ click.echo("Refer to the confluence page to find out how to configure internal resource map.")
28
+ exit(0)
29
+
24
30
  ctx.obj["internal"] = internal
25
31
 
26
32
  from sima_cli.utils.env import get_environment_type
sima_cli/update/local.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import subprocess
3
3
  import tempfile
4
- from typing import List
4
+ from typing import List, Tuple
5
5
  import pty
6
6
  import click
7
7
 
@@ -44,7 +44,7 @@ def _run_local_cmd(command: str, passwd: str) -> bool:
44
44
  return False
45
45
 
46
46
 
47
- def get_local_board_info() -> tuple[str, str]:
47
+ def get_local_board_info() -> Tuple[str, str]:
48
48
  """
49
49
  Retrieve the local board type and build version by reading /etc/build.
50
50
 
sima_cli/update/remote.py CHANGED
@@ -7,6 +7,7 @@ import itertools
7
7
  import threading
8
8
  import sys
9
9
  import select
10
+ from typing import Tuple
10
11
 
11
12
  DEFAULT_USER = "sima"
12
13
  DEFAULT_PASSWORD = "edgeai"
@@ -50,7 +51,7 @@ def _wait_for_ssh(ip: str, timeout: int = 120):
50
51
  else:
51
52
  print("\r✅ Board is online! \n")
52
53
 
53
- def get_remote_board_info(ip: str, passwd: str = DEFAULT_PASSWORD) -> tuple[str, str]:
54
+ def get_remote_board_info(ip: str, passwd: str = DEFAULT_PASSWORD) -> Tuple[str, str]:
54
55
  """
55
56
  Connect to the remote board and retrieve board type and build version.
56
57
 
@@ -35,8 +35,8 @@ def _resolve_firmware_url(version_or_url: str, board: str, internal: bool = Fals
35
35
  repo_cfg = cfg.get("internal" if internal else "public", {}).get("download")
36
36
  artifactory_cfg = cfg.get("internal" if internal else "public", {}).get("artifactory")
37
37
  base_url = artifactory_cfg.get("url", {})
38
-
39
- url = f"{base_url}/{repo_cfg.get("download_url")}"
38
+ download_url = repo_cfg.get("download_url")
39
+ url = f"{base_url}/{download_url}"
40
40
  if not url:
41
41
  raise RuntimeError("⚠️ 'url' is not defined in resource config.")
42
42
 
@@ -317,7 +317,7 @@ def perform_update(version_or_url: str, ip: str = None, board: str = "davinci",
317
317
 
318
318
  extracted_paths = _download_image(version_or_url, board, internal)
319
319
  click.echo("⚠️ DO NOT INTERRUPT THE UPDATE PROCESS...")
320
-
320
+
321
321
  if len(extracted_paths) > 0:
322
322
  if env_type == "host" and env_subtype == 'linux':
323
323
  # Always update the remote device first then update the host driver, otherwise the host would
@@ -1,4 +1,5 @@
1
1
  import requests
2
+ import logging
2
3
  from typing import Optional, Tuple
3
4
 
4
5
  def exchange_identity_token(
@@ -28,3 +28,13 @@ def load_resource_config():
28
28
  config["internal"] = yaml.safe_load(f) or {}
29
29
 
30
30
  return config
31
+
32
+ def internal_resource_exists():
33
+ """
34
+ Check if the internal resource YAML file exists.
35
+
36
+ Returns:
37
+ bool: True if the internal resource file exists, False otherwise.
38
+ """
39
+ internal_path = os.path.join(os.path.expanduser("~"), ".sima-cli", "resources_internal.yaml")
40
+ return os.path.exists(internal_path)
sima_cli/utils/env.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import subprocess
3
3
  import platform
4
+ from typing import Tuple
4
5
 
5
6
  # Utility functions to determine the environment:
6
7
  # - Whether we are running on a SiMa board
@@ -86,7 +87,7 @@ def is_palette_sdk() -> bool:
86
87
  except Exception:
87
88
  return False
88
89
 
89
- def get_environment_type() -> tuple[str, str]:
90
+ def get_environment_type() -> Tuple[str, str]:
90
91
  """
91
92
  Return the environment type and subtype as a tuple.
92
93
 
@@ -113,7 +114,7 @@ def get_environment_type() -> tuple[str, str]:
113
114
 
114
115
  return "host", "unknown"
115
116
 
116
- def check_pcie_card_installation() -> tuple[bool, str]:
117
+ def check_pcie_card_installation() -> Tuple[bool, str]:
117
118
  """
118
119
  Check whether the PCIe SiMa card is properly installed on a supported Linux host.
119
120
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sima-cli
3
- Version: 0.0.11
3
+ Version: 0.0.13
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
@@ -13,7 +13,7 @@ Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Topic :: Software Development :: Build Tools
15
15
  Classifier: Environment :: Console
16
- Requires-Python: >=3.10
16
+ Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: requests
@@ -1,26 +1,26 @@
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=sGvIeMZm0sgBPjFQzdwrUk7MS8HYwQBhWImKqp6AiFg,49
4
- sima_cli/cli.py,sha256=yLrzM-S4UsJXvWB3gLQb7YPAJTERwZUpavwM0F7TGQU,5702
3
+ sima_cli/__version__.py,sha256=HIATn2M6NOw71vakibWXUOPNt1MzrZdtVUqxl8ScDyU,49
4
+ sima_cli/cli.py,sha256=hXWL2K7PHC2ezWEdsw2O6FPqjqLUC9sCv53YX7JXK5w,6114
5
5
  sima_cli/app_zoo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  sima_cli/app_zoo/app.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  sima_cli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- sima_cli/auth/login.py,sha256=HqnYEuYORI955Yc6WMnjbPW055Za0aswSUdKSeQ1kfI,3596
8
+ sima_cli/auth/login.py,sha256=lnTfJrwrRznNY6zWEl2AwAveGJoCduPiOHLiGxTIyJ4,3660
9
9
  sima_cli/download/__init__.py,sha256=6y4O2FOCYFR2jdnQoVi3hRtEoZ0Gw6rydlTy1SGJ5FE,218
10
10
  sima_cli/download/downloader.py,sha256=zL8daM7Fqj1evzfQ9EHL1CVbuYL0_aQNhromqm7LkE0,4863
11
11
  sima_cli/model_zoo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  sima_cli/model_zoo/model.py,sha256=WwtxyPiL0XAOFwH1JUK4aWnZpROHULTwfsnv0Y5_DpM,5223
13
13
  sima_cli/update/__init__.py,sha256=0P-z-rSaev40IhfJXytK3AFWv2_sdQU4Ry6ei2sEus0,66
14
- sima_cli/update/local.py,sha256=s2K-FSeScHc4O5aUx2Uxo50BUg1auzEwNgfjrzKLzFQ,3025
15
- sima_cli/update/remote.py,sha256=MFGanQvOQb76JRyiYccE7Tce2wABfixBoe_dJ0CH520,8395
16
- sima_cli/update/updater.py,sha256=zCNqK50aBXuYw2ZtxzzNYoKRhqVSFx62BYAKe2S5YJo,13549
14
+ sima_cli/update/local.py,sha256=jiGrwuU2Z1HV_RT1_dYuI_Ish-f818AvCEk7sAM3l94,3032
15
+ sima_cli/update/remote.py,sha256=ePlnvlGHrASMMjYGM9w-6hMeDMgGiJu_BlHLamU1YtI,8420
16
+ sima_cli/update/updater.py,sha256=lrXYV1Iy2u7leY043GUSIfP0g9MaKTjSoo1hrMyiChk,13572
17
17
  sima_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- sima_cli/utils/artifactory.py,sha256=ZDw8dxbIvtUKS3c9tRHT5Y7LlFAkTp3p_ar5oqL6JIo,2375
18
+ sima_cli/utils/artifactory.py,sha256=6YyVpzVm8ATy7NEwT9nkWx-wptkXrvG7Wl_zDT6jmLs,2390
19
19
  sima_cli/utils/config.py,sha256=wE-cPQqY_gOqaP8t01xsRHD9tBUGk9MgBUm2GYYxI3E,1616
20
- sima_cli/utils/config_loader.py,sha256=CcfjN1FbV-rppNXkmKVdfNpZqeSx1mCB8ylLhlJKAzU,922
21
- sima_cli/utils/env.py,sha256=MjIHTioSvx8rQfHoLCAn5VzhaJwvXceTAcrmATXtn2Y,5487
20
+ sima_cli/utils/config_loader.py,sha256=MTNQXK7hRy3n5SgzVsjXyjIHInZH9RdAcQtsLM6f3RU,1250
21
+ sima_cli/utils/env.py,sha256=LJy2eO8cfEYsLuC7p3BT_FAoaZc9emtq6NYhHRBpiBE,5512
22
22
  sima_cli/utils/network.py,sha256=UvqxbqbWUczGFyO-t1SybG7Q-x9kjUVRNIn_D6APzy8,1252
23
- sima_cli-0.0.11.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
23
+ sima_cli-0.0.13.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
24
24
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  tests/test_app_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  tests/test_auth.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -29,8 +29,8 @@ tests/test_download.py,sha256=t87DwxlHs26_ws9rpcHGwr_OrcRPd3hz6Zmm0vRee2U,4465
29
29
  tests/test_firmware.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  tests/test_model_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- sima_cli-0.0.11.dist-info/METADATA,sha256=zk5Ncrdtak-j0sh2dxDyB_WtX1JF4zHO55ZEcZfbmrw,3563
33
- sima_cli-0.0.11.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
34
- sima_cli-0.0.11.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
35
- sima_cli-0.0.11.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
36
- sima_cli-0.0.11.dist-info/RECORD,,
32
+ sima_cli-0.0.13.dist-info/METADATA,sha256=ffFCnatscJoVHDiYr3UclBVrHc_MbkPUBwwDtCMhXZo,3562
33
+ sima_cli-0.0.13.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
34
+ sima_cli-0.0.13.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
35
+ sima_cli-0.0.13.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
36
+ sima_cli-0.0.13.dist-info/RECORD,,