remotivelabs-cli 0.2.3__py3-none-any.whl → 0.3.1__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.

Files changed (55) hide show
  1. cli/broker/__init__.py +36 -0
  2. cli/broker/discovery.py +43 -0
  3. cli/broker/export.py +6 -36
  4. cli/broker/files.py +12 -12
  5. cli/broker/lib/broker.py +132 -106
  6. cli/broker/lib/client.py +224 -0
  7. cli/broker/lib/helper.py +277 -0
  8. cli/broker/lib/signalcreator.py +196 -0
  9. cli/broker/license_flows.py +11 -13
  10. cli/broker/playback.py +10 -10
  11. cli/broker/record.py +4 -4
  12. cli/broker/scripting.py +6 -9
  13. cli/broker/signals.py +17 -19
  14. cli/cloud/__init__.py +17 -0
  15. cli/cloud/auth/cmd.py +74 -33
  16. cli/cloud/auth/login.py +42 -54
  17. cli/cloud/auth_tokens.py +40 -247
  18. cli/cloud/brokers.py +5 -9
  19. cli/cloud/configs.py +4 -17
  20. cli/cloud/licenses/__init__.py +0 -0
  21. cli/cloud/licenses/cmd.py +14 -0
  22. cli/cloud/organisations.py +12 -17
  23. cli/cloud/projects.py +3 -3
  24. cli/cloud/recordings.py +35 -61
  25. cli/cloud/recordings_playback.py +22 -22
  26. cli/cloud/resumable_upload.py +6 -6
  27. cli/cloud/service_account_tokens.py +4 -3
  28. cli/cloud/storage/cmd.py +2 -3
  29. cli/cloud/storage/copy.py +2 -1
  30. cli/connect/connect.py +4 -4
  31. cli/connect/protopie/protopie.py +22 -30
  32. cli/remotive.py +16 -26
  33. cli/settings/__init__.py +1 -2
  34. cli/settings/config_file.py +2 -0
  35. cli/settings/core.py +146 -146
  36. cli/settings/migration/migrate_config_file.py +13 -6
  37. cli/settings/migration/migration_tools.py +6 -4
  38. cli/settings/state_file.py +12 -4
  39. cli/tools/can/can.py +4 -7
  40. cli/topology/__init__.py +3 -0
  41. cli/topology/cmd.py +60 -83
  42. cli/topology/start_trial.py +105 -0
  43. cli/typer/typer_utils.py +3 -6
  44. cli/utils/console.py +61 -0
  45. cli/utils/rest_helper.py +33 -31
  46. cli/utils/versions.py +7 -19
  47. {remotivelabs_cli-0.2.3.dist-info → remotivelabs_cli-0.3.1.dist-info}/METADATA +3 -2
  48. remotivelabs_cli-0.3.1.dist-info/RECORD +74 -0
  49. cli/broker/brokers.py +0 -93
  50. cli/cloud/cloud_cli.py +0 -29
  51. cli/errors.py +0 -44
  52. remotivelabs_cli-0.2.3.dist-info/RECORD +0 -67
  53. {remotivelabs_cli-0.2.3.dist-info → remotivelabs_cli-0.3.1.dist-info}/LICENSE +0 -0
  54. {remotivelabs_cli-0.2.3.dist-info → remotivelabs_cli-0.3.1.dist-info}/WHEEL +0 -0
  55. {remotivelabs_cli-0.2.3.dist-info → remotivelabs_cli-0.3.1.dist-info}/entry_points.txt +0 -0
cli/broker/brokers.py DELETED
@@ -1,93 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
- from time import sleep
5
-
6
- import typer
7
- from zeroconf import (
8
- IPVersion,
9
- ServiceBrowser,
10
- ServiceStateChange,
11
- Zeroconf,
12
- )
13
-
14
- from cli.typer import typer_utils
15
-
16
- from . import export, files, licenses, playback, record, scripting, signals
17
-
18
- app = typer_utils.create_typer(rich_markup_mode="rich")
19
-
20
-
21
- @app.callback()
22
- def main(
23
- url: str = typer.Option(None, is_eager=False, help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
24
- ) -> None:
25
- # This can be used to override the --url per command, lets see if this is a better approach
26
- if url is not None:
27
- os.environ["REMOTIVE_BROKER_URL"] = url
28
- # Do other global stuff, handle other global options here
29
-
30
-
31
- @app.command(help="Discover brokers on this network")
32
- def discover() -> None:
33
- # print("Not implemented")
34
-
35
- zeroconf = Zeroconf(ip_version=IPVersion.V4Only)
36
-
37
- services = ["_remotivebroker._tcp.local."]
38
- # services = list(ZeroconfServiceTypes.find(zc=zeroconf))
39
-
40
- print("\nLooking for RemotiveBrokers on your network, press Ctrl-C to exit...\n")
41
- ServiceBrowser(zeroconf, services, handlers=[on_service_state_change])
42
-
43
- try:
44
- while True:
45
- sleep(0.1)
46
- except KeyboardInterrupt:
47
- pass
48
- finally:
49
- zeroconf.close()
50
-
51
-
52
- def on_service_state_change(zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange) -> None:
53
- # print(f"Service {name} state changed: {state_change}")
54
-
55
- if state_change is ServiceStateChange.Removed:
56
- print(f"Service {name} was removed")
57
-
58
- if state_change is ServiceStateChange.Updated:
59
- print(f"Service {name} was updated")
60
-
61
- if state_change is ServiceStateChange.Added:
62
- print(f"[ {name} ]")
63
- info = zeroconf.get_service_info(service_type, name)
64
- # print("Info from zeroconf.get_service_info: %r" % (info))
65
-
66
- if info:
67
- # addresses = ["%s:%d" % (addr, cast(int, info.port)) for addr in info.parsed_scoped_addresses()]
68
- for addr in info.parsed_scoped_addresses():
69
- print(f"RemotiveBrokerApp: http://{addr}:8080")
70
- print(f"RemotiveBroker http://{addr}:50051")
71
- # print(" Weight: %d, priority: %d" % (info.weight, info.priority))
72
- # print(f" Server: {info.server}")
73
- # if info.properties:
74
- # print(" Properties are:")
75
- # for key, value in info.properties.items():
76
- # print(f" {key}: {value}")
77
- # else:
78
- # print(" No properties")
79
- else:
80
- print(" No info")
81
- print("\n")
82
-
83
-
84
- app.add_typer(playback.app, name="playback", help="Manage playing recordings")
85
- app.add_typer(record.app, name="record", help="Record data on buses")
86
- app.add_typer(files.app, name="files", help="Upload/Download configurations and recordings")
87
- app.add_typer(signals.app, name="signals", help="Find and subscribe to signals")
88
- app.add_typer(export.app, name="export", help="Export to external formats")
89
- app.add_typer(scripting.app, name="scripting", help="LUA scripting utilities")
90
- app.add_typer(licenses.app, name="license", help="View and request license to broker")
91
-
92
- if __name__ == "__main__":
93
- app()
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()
cli/errors.py DELETED
@@ -1,44 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
- import sys
5
- from typing import Optional
6
-
7
- import grpc
8
- from rich.console import Console
9
-
10
- err_console = Console(stderr=True)
11
-
12
-
13
- # This should be renamed to Printer since print_generic_message is not an error message.
14
- # Then we can also add more things here
15
- class ErrorPrinter:
16
- @staticmethod
17
- def print_grpc_error(error: grpc.RpcError) -> None:
18
- if error.code() == grpc.StatusCode.UNAUTHENTICATED:
19
- is_access_token = os.environ["ACCESS_TOKEN"]
20
- if is_access_token is not None and is_access_token == "true":
21
- err_console.print(f":boom: [bold red]Authentication failed[/bold red]: {error.details()}")
22
- err_console.print("Please login again")
23
- else:
24
- err_console.print(":boom: [bold red]Authentication failed[/bold red]")
25
- err_console.print("Failed to verify api-key")
26
- else:
27
- # print(f"Unexpected error: {error.code()}")
28
- err_console.print(f":boom: [bold red]Unexpected error, status code[/bold red]: {error.code()}")
29
- err_console.print(error.details())
30
- sys.exit(1)
31
-
32
- @staticmethod
33
- def print_hint(message: str) -> None:
34
- err_console.print(f":point_right: [bold]{message}[/bold]")
35
-
36
- @staticmethod
37
- def print_generic_error(message: str, exit_code: Optional[int] = None) -> None:
38
- err_console.print(f":boom: [bold red]Failed[/bold red]: {message}")
39
- if exit_code is not None:
40
- sys.exit(exit_code)
41
-
42
- @staticmethod
43
- def print_generic_message(message: str) -> None:
44
- err_console.print(f"[bold]{message}[/bold]")
@@ -1,67 +0,0 @@
1
- cli/.DS_Store,sha256=7HTaExsH9zU3sluA0MFtZuyzNmSnUmH2Sh09uoek84E,8196
2
- cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- cli/api/cloud/tokens.py,sha256=3UKfVM3NvZX_ynpPAXZ_cnrPAIIgg0vA1FuOzj8TV2o,1631
4
- cli/broker/brokers.py,sha256=lfO0oAuOwLiJkuNIusXCnOGrxEKGvQjy75LMY9jP5-Y,3234
5
- cli/broker/export.py,sha256=rr6OGZmkbqVUljy-gluC2CeRDKbI_p41EhleT3lcgXQ,4481
6
- cli/broker/files.py,sha256=JMpyBYfqVX_ppIChDcUuWvCDIQHC8YI6IsljyIL0NZ8,4212
7
- cli/broker/lib/__about__.py,sha256=xnZ5V6ZcHW9dhWLWdMzVjYJbEnMKpeXm0_S_mbNzypE,141
8
- cli/broker/lib/broker.py,sha256=Qu6OuKt0P4aFPRSbmcdXUly9iQrnDgUcHTjVJzahTCQ,25006
9
- cli/broker/license_flows.py,sha256=du5SSAdzr2VZeORWoAgbYrfi-mpnDUQfIVpfAJK6CSM,7216
10
- cli/broker/licenses.py,sha256=jIuLB2qBGflzSjm952CBnErpzs7iIkmEgx9L8GDAPNc,4021
11
- cli/broker/playback.py,sha256=fO-ZvzmB3ZzanmD1L09PeKkabx35uKsELMM-h-5brSE,4023
12
- cli/broker/record.py,sha256=rVjvyWRSWNFtthZZkZeZZGvZdmhDB_qmYcrCocCJxY4,1445
13
- cli/broker/scripting.py,sha256=LFLdaBNxe2sfpcxhDmRlAbEorjL3SJZNK-zEdLQ9ySU,3854
14
- cli/broker/signals.py,sha256=MFj_bOLIxHY1v3XPkKk6n8U3JLaY8nrXHahRQaVse6s,8207
15
- cli/cloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- 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/brokers.py,sha256=QTA9bmaK06LKEccF6IBgWBonC4VFrKwFQBsACX_IzYw,3896
21
- cli/cloud/cloud_cli.py,sha256=q-oiaLcKC-BRamXfIFGn-BskRmJ3utA7-tI39lSs3Cs,1309
22
- cli/cloud/configs.py,sha256=uv46nUoGXOr99smQHahv_ageDv6bGYfUnlRlxcS5D9A,5125
23
- cli/cloud/organisations.py,sha256=YF8HiF-dRz-FeCxjKFmFqm81SLI0FTUKM2SGCxMPfwY,4075
24
- cli/cloud/projects.py,sha256=ecn5Y8UKhgYnHSJQACUk1GNZt9EF8ug4B-6MCr8rZqM,1487
25
- cli/cloud/recordings.py,sha256=In2fKX668CPsEVBAy7zkU92lEnmu3UcnqiVrqsvLNDQ,24961
26
- cli/cloud/recordings_playback.py,sha256=XZoVyujufMQFN2v_Nwsf8tOqn61yLEpAf2z_u5uhXik,11532
27
- cli/cloud/resumable_upload.py,sha256=8lEIdncJZoTZzNsQVHH3gm_GunxEmN5JbmWX7awy3p4,3713
28
- cli/cloud/sample_recordings.py,sha256=RmuT-a2iMwGj3LXVcPkV5l66uFcf7nyWyJciUjnYkk4,721
29
- cli/cloud/service_account_tokens.py,sha256=lZHrja2hIyeXGTNGsxaZ_NlS_iXcyWR_h62H4OYeTMk,2783
30
- cli/cloud/service_accounts.py,sha256=AiktZW5QTbT6sAPJi4ubETOqbBDAIt4LOE-TZmIiIkk,2586
31
- cli/cloud/storage/__init__.py,sha256=ijl9WwU5D4oASbwrFKJurYsBUyzwZCOhcdTQYj-ZSeM,159
32
- cli/cloud/storage/cmd.py,sha256=UOPpzZeqtqAD2qAbFRGHnbpliq6T_8phKQSxU0EeaqI,2970
33
- cli/cloud/storage/copy.py,sha256=tPvRcKFhzxbBhjvQ6ZGMe81hksfYwbn7dEgrjpYaC0Q,3237
34
- cli/cloud/storage/uri_or_path.py,sha256=DLlyr0RAV-DRlL2C36U-jvUqwiLIlkw7c3mJ7SSGMdI,1158
35
- cli/cloud/uri.py,sha256=QZCus--KJQlVwGCOzZqiglvj8VvSRKxfVvN33Pilgyg,3616
36
- cli/connect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- cli/connect/connect.py,sha256=SH2DNTTVLu2dNpk6xIah1-KJZAqrK_7Skt8RKp8Mjh8,4231
38
- cli/connect/protopie/protopie.py,sha256=ElmrGaV0ivb85wo0gLzCAXZhmSmIDASaCVlF1iQblLI,6532
39
- 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/settings/migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- 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
47
- cli/settings/migration/migrate_legacy_dirs.py,sha256=N0t2io3bT_ub8BcVPw1CeQ4eeexRUiu3jXq3DL018OE,1819
48
- 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
51
- cli/settings/token_file.py,sha256=9GZh44eaXtn30EA06mzQ-69yBT06ig03doqfUHisAw0,3921
52
- cli/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
- cli/tools/can/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- cli/tools/can/can.py,sha256=TtP5w8vb0QG4ObNhkWIDpRMdNelirFffoc_lFZy8ePM,2260
55
- cli/tools/tools.py,sha256=jhLfrFDqkmWV3eBAzNwBf6WgDGrz7sOhgVCia36Twn8,232
56
- cli/topology/cmd.py,sha256=Fv5HwvHh6Ie29dcEtD1do-Zxg6fUTwlV9zw42ZKUkvc,4036
57
- cli/typer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- cli/typer/typer_utils.py,sha256=TaJuK1EtE9Gv3DfmoyHPTNKmhiAimuQCHKxQjnUZ7bs,737
59
- cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- cli/utils/rest_helper.py,sha256=KVoisWqBfEe20dQ6F4n9qYOYPmtGqs5EMMOCmtCjQ8Y,14120
61
- 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,,