remotivelabs-cli 0.2.3__py3-none-any.whl → 0.3.0__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 remotivelabs-cli might be problematic. Click here for more details.

cli/utils/rest_helper.py CHANGED
@@ -16,7 +16,7 @@ from rich.console import Console
16
16
  from rich.progress import Progress, SpinnerColumn, TextColumn, wrap_file
17
17
 
18
18
  from cli.errors import ErrorPrinter
19
- from cli.settings import TokenNotFoundError, settings
19
+ from cli.settings import settings
20
20
  from cli.utils import versions
21
21
 
22
22
  err_console = Console(stderr=True)
@@ -86,27 +86,22 @@ class RestHelper:
86
86
  def ensure_auth_token(quiet: bool = False, access_token: Optional[str] = None) -> None:
87
87
  # TODO: remove this? We already set the default organization as env in remotive.py
88
88
  if "REMOTIVE_CLOUD_ORGANIZATION" not in os.environ:
89
- active_account = settings.get_cli_config().get_active_account()
89
+ active_account = settings.get_active_account()
90
90
  if active_account:
91
91
  org = active_account.default_organization
92
92
  if org:
93
93
  os.environ["REMOTIVE_CLOUD_ORGANIZATION"] = org
94
94
 
95
- token = None
95
+ token = access_token
96
+ if not token:
97
+ token = os.environ.get("REMOTIVE_CLOUD_ACCESS_TOKEN", settings.get_active_token())
98
+ if not token:
99
+ if quiet:
100
+ return
101
+ ErrorPrinter.print_hint("you are not logged in, please login using [green]remotive cloud auth login[/green]")
102
+ sys.exit(1)
96
103
 
97
- if access_token is None:
98
- if "REMOTIVE_CLOUD_ACCESS_TOKEN" in os.environ:
99
- token = os.environ["REMOTIVE_CLOUD_ACCESS_TOKEN"]
100
- else:
101
- try:
102
- token = settings.get_active_token()
103
- except TokenNotFoundError:
104
- if quiet:
105
- return
106
- ErrorPrinter.print_hint("you are not logged in, please login using [green]remotive cloud auth login[/green]")
107
- sys.exit(1)
108
-
109
- RestHelper.__headers["Authorization"] = f"Bearer {token.strip() if token is not None else access_token}"
104
+ RestHelper.__headers["Authorization"] = f"Bearer {token.strip()}"
110
105
 
111
106
  @staticmethod
112
107
  def handle_get( # noqa: PLR0913
cli/utils/versions.py CHANGED
@@ -5,7 +5,6 @@ import json
5
5
  import os
6
6
  import platform
7
7
  import urllib.request
8
- from datetime import timedelta
9
8
  from importlib import metadata as importlib_metadata
10
9
  from importlib.metadata import version as python_project_version
11
10
 
@@ -85,26 +84,17 @@ def check_for_update(settings: Settings) -> None:
85
84
  # Make it possible to disable update check, i.e in CI
86
85
  if os.environ.get("PYTHON_DISABLE_UPDATE_CHECK"):
87
86
  return
88
- project = "remotivelabs-cli"
87
+
88
+ # Check if we are allowed to perform an update check
89
+ if not settings.should_perform_update_check():
90
+ return
89
91
 
90
92
  # Determine current version
93
+ project = "remotivelabs-cli"
91
94
  cur = cli_version() or _installed_version(project)
92
95
  if not cur:
93
96
  return # unknown version → skip silently
94
97
 
95
- state = settings.get_state_file()
96
- if not state.last_update_check_time:
97
- if os.environ.get("RUNS_IN_DOCKER"):
98
- # To prevent that we always check update in docker due to ephemeral disks we write an "old" check if the state
99
- # is missing. If no disk is mounted we will never get the update check but if its mounted properly we will get
100
- # it on the second attempt. This is good enough
101
- last_update_check_time = (datetime.datetime.now() - timedelta(hours=10)).isoformat()
102
- settings.set_last_update_check_time(last_update_check_time)
103
- return
104
-
105
- elif not state.should_perform_update_check():
106
- return
107
-
108
98
  # We end up here if last_update_check_time is None or should_perform_update_check is true
109
99
  include_prereleases = Version(cur).is_prerelease or Version(cur).is_devrelease
110
100
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: remotivelabs-cli
3
- Version: 0.2.3
3
+ Version: 0.3.0
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -20,7 +20,8 @@ Requires-Dist: pydantic (>=2.11.7,<3.0.0)
20
20
  Requires-Dist: pyjwt (>=2.6,<3.0)
21
21
  Requires-Dist: python-can (>=4.3.1)
22
22
  Requires-Dist: python-socketio (>=4.6.1)
23
- Requires-Dist: remotivelabs-broker (>=0.1.17,<0.2.0)
23
+ Requires-Dist: remotivelabs-broker (>=0.9.1,<0.10.0)
24
+ Requires-Dist: requests (>=2.32.4,<3.0.0)
24
25
  Requires-Dist: rich (>=13.7.0,<13.8.0)
25
26
  Requires-Dist: trogon (>=0.5.0)
26
27
  Requires-Dist: typer (==0.12.5)
@@ -5,28 +5,32 @@ cli/broker/brokers.py,sha256=lfO0oAuOwLiJkuNIusXCnOGrxEKGvQjy75LMY9jP5-Y,3234
5
5
  cli/broker/export.py,sha256=rr6OGZmkbqVUljy-gluC2CeRDKbI_p41EhleT3lcgXQ,4481
6
6
  cli/broker/files.py,sha256=JMpyBYfqVX_ppIChDcUuWvCDIQHC8YI6IsljyIL0NZ8,4212
7
7
  cli/broker/lib/__about__.py,sha256=xnZ5V6ZcHW9dhWLWdMzVjYJbEnMKpeXm0_S_mbNzypE,141
8
- cli/broker/lib/broker.py,sha256=Qu6OuKt0P4aFPRSbmcdXUly9iQrnDgUcHTjVJzahTCQ,25006
8
+ cli/broker/lib/broker.py,sha256=W7wp21nvXWm96y5LvSVmRIi3wiNtOFA8Bx-al8CVEIQ,26420
9
+ cli/broker/lib/client.py,sha256=2Nwrd_PY1gqQNqkWc9QTJVFDMAZebAzVnCFUTqiArwE,8540
10
+ cli/broker/lib/helper.py,sha256=ECwygqZHFkRhV-h4EVOUOkOVgXnmsuJP4OnIJtarh7c,9316
11
+ cli/broker/lib/signalcreator.py,sha256=CDInuSAmNrOlEya_br8CGZR1VNAXY7CXkF9s3mQUpHk,8201
9
12
  cli/broker/license_flows.py,sha256=du5SSAdzr2VZeORWoAgbYrfi-mpnDUQfIVpfAJK6CSM,7216
10
13
  cli/broker/licenses.py,sha256=jIuLB2qBGflzSjm952CBnErpzs7iIkmEgx9L8GDAPNc,4021
11
14
  cli/broker/playback.py,sha256=fO-ZvzmB3ZzanmD1L09PeKkabx35uKsELMM-h-5brSE,4023
12
15
  cli/broker/record.py,sha256=rVjvyWRSWNFtthZZkZeZZGvZdmhDB_qmYcrCocCJxY4,1445
13
16
  cli/broker/scripting.py,sha256=LFLdaBNxe2sfpcxhDmRlAbEorjL3SJZNK-zEdLQ9ySU,3854
14
17
  cli/broker/signals.py,sha256=MFj_bOLIxHY1v3XPkKk6n8U3JLaY8nrXHahRQaVse6s,8207
15
- cli/cloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ cli/cloud/__init__.py,sha256=xFaDg2zho_glvDBDB0_8HRNICVwHeYFEz-yMhzTcCjI,987
16
19
  cli/cloud/auth/__init__.py,sha256=MtQ01-n8CgZb9Y_SvxwZUgj44Yo0dFAU3_XwhQiUYtw,54
17
- cli/cloud/auth/cmd.py,sha256=gLmfjIN9Vrytk9BwGH1cq4WeeryOfwTTnQ4yuZrbRcs,2757
18
- cli/cloud/auth/login.py,sha256=dX6M5ysE0n9Zg3gVT7hJbChxTsmuba-Z-1Or6DCFYis,11511
19
- cli/cloud/auth_tokens.py,sha256=ubY5KndOKGr0G5a1QCXOaCQ2OPBM3BkkIWCG-WmLKCI,12513
20
+ cli/cloud/auth/cmd.py,sha256=buLqfd9JGg8ziR749nNhaeXfMZTstIsrYvAib7kBQrU,3872
21
+ cli/cloud/auth/login.py,sha256=cS860pSMuw8aN6PAmtMxLDSkFEaFRjghTodLQNUHB2A,11466
22
+ cli/cloud/auth_tokens.py,sha256=K94lC6QLAuiADZYk0k-4iYabz9AGl_rNFj02xlKeNZs,5148
20
23
  cli/cloud/brokers.py,sha256=QTA9bmaK06LKEccF6IBgWBonC4VFrKwFQBsACX_IzYw,3896
21
- cli/cloud/cloud_cli.py,sha256=q-oiaLcKC-BRamXfIFGn-BskRmJ3utA7-tI39lSs3Cs,1309
22
24
  cli/cloud/configs.py,sha256=uv46nUoGXOr99smQHahv_ageDv6bGYfUnlRlxcS5D9A,5125
23
- cli/cloud/organisations.py,sha256=YF8HiF-dRz-FeCxjKFmFqm81SLI0FTUKM2SGCxMPfwY,4075
25
+ cli/cloud/licenses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ cli/cloud/licenses/cmd.py,sha256=zq-Cc5OdftDyUR4dDqGnCmeNF62XR_kYC3mYXEKFZCw,477
27
+ cli/cloud/organisations.py,sha256=IYpcWwczuWfgY1WqM9d6duXu7F7KMw4v8koeo_ERhkA,3950
24
28
  cli/cloud/projects.py,sha256=ecn5Y8UKhgYnHSJQACUk1GNZt9EF8ug4B-6MCr8rZqM,1487
25
29
  cli/cloud/recordings.py,sha256=In2fKX668CPsEVBAy7zkU92lEnmu3UcnqiVrqsvLNDQ,24961
26
30
  cli/cloud/recordings_playback.py,sha256=XZoVyujufMQFN2v_Nwsf8tOqn61yLEpAf2z_u5uhXik,11532
27
31
  cli/cloud/resumable_upload.py,sha256=8lEIdncJZoTZzNsQVHH3gm_GunxEmN5JbmWX7awy3p4,3713
28
32
  cli/cloud/sample_recordings.py,sha256=RmuT-a2iMwGj3LXVcPkV5l66uFcf7nyWyJciUjnYkk4,721
29
- cli/cloud/service_account_tokens.py,sha256=lZHrja2hIyeXGTNGsxaZ_NlS_iXcyWR_h62H4OYeTMk,2783
33
+ cli/cloud/service_account_tokens.py,sha256=9ffBUM1qXsRaJgOviwINxJl2ndKYKuBr_SXGrcOW3mA,2788
30
34
  cli/cloud/service_accounts.py,sha256=AiktZW5QTbT6sAPJi4ubETOqbBDAIt4LOE-TZmIiIkk,2586
31
35
  cli/cloud/storage/__init__.py,sha256=ijl9WwU5D4oASbwrFKJurYsBUyzwZCOhcdTQYj-ZSeM,159
32
36
  cli/cloud/storage/cmd.py,sha256=UOPpzZeqtqAD2qAbFRGHnbpliq6T_8phKQSxU0EeaqI,2970
@@ -35,33 +39,33 @@ cli/cloud/storage/uri_or_path.py,sha256=DLlyr0RAV-DRlL2C36U-jvUqwiLIlkw7c3mJ7SSG
35
39
  cli/cloud/uri.py,sha256=QZCus--KJQlVwGCOzZqiglvj8VvSRKxfVvN33Pilgyg,3616
36
40
  cli/connect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
41
  cli/connect/connect.py,sha256=SH2DNTTVLu2dNpk6xIah1-KJZAqrK_7Skt8RKp8Mjh8,4231
38
- cli/connect/protopie/protopie.py,sha256=ElmrGaV0ivb85wo0gLzCAXZhmSmIDASaCVlF1iQblLI,6532
42
+ cli/connect/protopie/protopie.py,sha256=hd0WBZG7LZXMq4rHU03C-LJ_ZfG6CDkXEgYAJEP78XA,6529
39
43
  cli/errors.py,sha256=djODw6sdMJXzOsuAUOP3N13nfmm1sIP3Pe6tllGdozM,1657
40
- cli/remotive.py,sha256=Fvu6mKU5CPWZZ5WL9UsQqC-LYswb70GBlvpq4J92AVE,4015
41
- cli/settings/__init__.py,sha256=t1qkaGrJ4xx8WMHlmBTbQ1VdJL4YOcz8VFfRkGa2_jQ,711
42
- cli/settings/config_file.py,sha256=eWZK8YnuqGMy5rPJEqaX-M8_rnspklECRvES-C6_na4,3548
43
- cli/settings/core.py,sha256=ch59RiEB_TmyzO7nS5DW1VqkZ5PsDgGXhOs2CxPDxnw,11902
44
+ cli/remotive.py,sha256=kYefDVWw9oiEZtTNor-Dz2qhdMXCaoctu_SE0drpg80,3877
45
+ cli/settings/__init__.py,sha256=JsMr0E_hsM6IRHYeJUrlLBGyKnPdR4cDJd08-TjX274,665
46
+ cli/settings/config_file.py,sha256=QwsrVGB7JTqFNXlLkbWVcRSveW0HsKzU6Jl8mHqjdO8,3586
47
+ cli/settings/core.py,sha256=POnA5bwPNXA5EF9YRjEAZ36GS8A6I-O1vWzLbEDQDXY,10965
44
48
  cli/settings/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
49
  cli/settings/migration/migrate_all_token_files.py,sha256=xoVvAqn_tGskEW148uf3xZx1mpJKUnERMTcBo0nkCnI,3010
46
- cli/settings/migration/migrate_config_file.py,sha256=pgkQvRo814p75-lHydwL5aUmPG59TbbME61rL2--nZo,2001
50
+ cli/settings/migration/migrate_config_file.py,sha256=S8kyn3ZXbkej2TRLPcVDcYpvk2iW6kGo38OIutEZayo,2217
47
51
  cli/settings/migration/migrate_legacy_dirs.py,sha256=N0t2io3bT_ub8BcVPw1CeQ4eeexRUiu3jXq3DL018OE,1819
48
52
  cli/settings/migration/migrate_token_file.py,sha256=Fp7Z_lNqSdoWY05TYwFW2QH8q9QhmB2TYSok6hV1Mic,1530
49
- cli/settings/migration/migration_tools.py,sha256=P72tuw6-aS_Kd0qn-0ZecplsYxMTu0LTXM5sMSNTVEM,1378
50
- cli/settings/state_file.py,sha256=QvZIq-OH39RR60Y3HNbuGoJhYyP1Hmi6oE-ejJiO7S8,1566
53
+ cli/settings/migration/migration_tools.py,sha256=BK9zCzBulzQaZuiNkzLgH2SFRmLCYTopv0TXlo_QuK0,1318
54
+ cli/settings/state_file.py,sha256=rN6JNZP9ULZsuossk3M7jPhoIUgogAAcQGs4SJ-rI-4,2162
51
55
  cli/settings/token_file.py,sha256=9GZh44eaXtn30EA06mzQ-69yBT06ig03doqfUHisAw0,3921
52
56
  cli/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
57
  cli/tools/can/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
58
  cli/tools/can/can.py,sha256=TtP5w8vb0QG4ObNhkWIDpRMdNelirFffoc_lFZy8ePM,2260
55
59
  cli/tools/tools.py,sha256=jhLfrFDqkmWV3eBAzNwBf6WgDGrz7sOhgVCia36Twn8,232
56
- cli/topology/cmd.py,sha256=Fv5HwvHh6Ie29dcEtD1do-Zxg6fUTwlV9zw42ZKUkvc,4036
60
+ cli/topology/cmd.py,sha256=M5WB6wR37MbcVk4I5iyW04XFX9YIYXVYVLTejtEYFGw,3997
57
61
  cli/typer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
62
  cli/typer/typer_utils.py,sha256=TaJuK1EtE9Gv3DfmoyHPTNKmhiAimuQCHKxQjnUZ7bs,737
59
63
  cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- cli/utils/rest_helper.py,sha256=KVoisWqBfEe20dQ6F4n9qYOYPmtGqs5EMMOCmtCjQ8Y,14120
64
+ cli/utils/rest_helper.py,sha256=9MLIMiU3RR9dfZZFpCLxJnw4VXnl1Ga62k5knplDsjg,13881
61
65
  cli/utils/time.py,sha256=TEKcNZ-pQoJ7cZ6hQmVD0sTRwRm2rBy51-MuDNdO4S4,296
62
- cli/utils/versions.py,sha256=9O4wUFcAmEoi1rvKrZDqizSPMJ0HVlcO8k_OtRs8-yA,4438
63
- remotivelabs_cli-0.2.3.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
64
- remotivelabs_cli-0.2.3.dist-info/METADATA,sha256=eB_R_z5VmO1m_L-eCWqe89e7zIAm_pxVam3uyfMjwBc,1479
65
- remotivelabs_cli-0.2.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
66
- remotivelabs_cli-0.2.3.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
67
- remotivelabs_cli-0.2.3.dist-info/RECORD,,
66
+ cli/utils/versions.py,sha256=U0nq7M2wrUU9m4IL2_Rg1iST3PKN-leN_Huoe6jP4EQ,3846
67
+ remotivelabs_cli-0.3.0.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
68
+ remotivelabs_cli-0.3.0.dist-info/METADATA,sha256=mSh5ZaTWDlSWLDqquw5vXxz0gLNuSurXgqfgn3LtcV0,1521
69
+ remotivelabs_cli-0.3.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
70
+ remotivelabs_cli-0.3.0.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
71
+ remotivelabs_cli-0.3.0.dist-info/RECORD,,
cli/cloud/cloud_cli.py DELETED
@@ -1,29 +0,0 @@
1
- import typer
2
-
3
- from cli.cloud import auth, brokers, configs, organisations, projects, recordings, sample_recordings, service_accounts, storage
4
- from cli.typer import typer_utils
5
- from cli.utils.rest_helper import RestHelper
6
-
7
- app = typer_utils.create_typer()
8
-
9
-
10
- @app.command(help="List licenses for an organization")
11
- def licenses(
12
- organization: str = typer.Option(..., help="Organization ID", envvar="REMOTIVE_CLOUD_ORGANIZATION"),
13
- filter_option: str = typer.Option("all", help="all, valid, expired"),
14
- ) -> None:
15
- RestHelper.handle_get(f"/api/bu/{organization}/licenses", {"filter": filter_option})
16
-
17
-
18
- app.add_typer(organisations.app, name="organizations", help="Manage organizations")
19
- app.add_typer(projects.app, name="projects", help="Manage projects")
20
- app.add_typer(auth.app, name="auth")
21
- app.add_typer(brokers.app, name="brokers", help="Manage cloud broker lifecycle")
22
- app.add_typer(recordings.app, name="recordings", help="Manage recordings")
23
- app.add_typer(configs.app, name="signal-databases", help="Manage signal databases")
24
- app.add_typer(storage.app, name="storage")
25
- app.add_typer(service_accounts.app, name="service-accounts", help="Manage project service account keys")
26
- app.add_typer(sample_recordings.app, name="samples", help="Manage sample recordings")
27
-
28
- if __name__ == "__main__":
29
- app()