qbraid-cli 0.8.5__py3-none-any.whl → 0.8.5a1__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.
qbraid_cli/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.8.5'
15
+ __version__ = version = '0.8.5a1'
16
16
  __version_tuple__ = version_tuple = (0, 8, 5)
qbraid_cli/admin/app.py CHANGED
@@ -7,12 +7,14 @@ Module defining commands in the 'qbraid admin' namespace.
7
7
  """
8
8
  import typer
9
9
 
10
+ from qbraid_cli.admin.buildlogs import buildlogs_app
10
11
  from qbraid_cli.admin.headers import check_and_fix_headers
11
12
  from qbraid_cli.admin.validation import validate_header_type, validate_paths_exist
12
13
 
13
14
  admin_app = typer.Typer(
14
15
  help="CI/CD commands for qBraid maintainers.", pretty_exceptions_show_locals=False
15
16
  )
17
+ admin_app.add_typer(buildlogs_app, name="buildlogs")
16
18
 
17
19
 
18
20
  @admin_app.command(name="headers")
@@ -0,0 +1,114 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining commands in the 'qbraid admin buildlogs' namespace.
6
+
7
+ This module uses the Typer library to create CLI commands for managing Docker builds and logs
8
+ in an administrative context.
9
+ """
10
+
11
+ import json
12
+
13
+ import typer
14
+ from qbraid_core.exceptions import RequestsApiError
15
+ from qbraid_core.services.admin.client import AdminClient
16
+ from rich.console import Console
17
+
18
+ from qbraid_cli.handlers import handle_error
19
+
20
+ buildlogs_app = typer.Typer(
21
+ help="Manage qBraid containerized services logs.", pretty_exceptions_show_locals=False
22
+ )
23
+ console = Console()
24
+
25
+
26
+ @buildlogs_app.command(name="get")
27
+ def get_docker_build_logs(
28
+ build_id: str = typer.Option(None, "--build_id", "-b", help="Name of the build ID")
29
+ ) -> None:
30
+ """
31
+ Fetches and displays Docker build logs for a specified build ID.
32
+
33
+ Args:
34
+ build_id (str, optional): The unique identifier for the Docker build.
35
+
36
+ This function queries the administrative backend to retrieve and display build logs.
37
+ If a build ID is provided, it will retrieve and display logs specific to that build ID.
38
+ If build ID not provided, fetches all logs.
39
+ """
40
+ client = AdminClient()
41
+
42
+ build_log = client.get_docker_build_logs(build_id)
43
+ if build_id and "buildLogs" in build_log and build_log["buildLogs"]:
44
+ log_entry = build_log["buildLogs"][0]
45
+ console.print(log_entry)
46
+ else:
47
+ console.print(build_log)
48
+
49
+
50
+ @buildlogs_app.command(name="post")
51
+ def post_docker_build_log(
52
+ data: str = typer.Option(..., "--data", "-d", help="Data to post to Docker logs")
53
+ ) -> None:
54
+ """
55
+ Posts a new Docker build log entry.
56
+
57
+ Args:
58
+ data (str): JSON string containing the data to be logged.
59
+
60
+ This command converts a JSON string into a dictionary and sends it to the backend service
61
+ to create a new Docker build log.
62
+ """
63
+ client = AdminClient()
64
+
65
+ try:
66
+ data_dict = json.loads(data)
67
+ console.print(client.post_docker_build_logs(data_dict))
68
+ except RequestsApiError:
69
+ handle_error(message="Couldn't post a build_log.")
70
+
71
+
72
+ @buildlogs_app.command(name="put")
73
+ def put_docker_build_log(
74
+ build_id: str = typer.Option(..., "--build_id", "-b", help="Name of the build ID"),
75
+ data: str = typer.Option(..., "--data", "-d", help="Data to post to Docker logs"),
76
+ ) -> None:
77
+ """
78
+ Updates an existing Docker build log entry by a given build ID.
79
+
80
+ Args:
81
+ build_id (str): The unique identifier of the Docker build to update.
82
+ data (str): JSON string containing the updated data for the log.
83
+
84
+ This command updates a Docker build log entry, identified by the provided build ID,
85
+ with the new data provided in JSON format.
86
+ """
87
+ client = AdminClient()
88
+
89
+ try:
90
+ data_dict = json.loads(data)
91
+ console.print(client.put_docker_build_logs(build_id, data_dict))
92
+ except RequestsApiError:
93
+ handle_error(message="Couldn't post a build_log.")
94
+
95
+
96
+ @buildlogs_app.command(name="delete")
97
+ def delete_docker_build_log(
98
+ build_id: str = typer.Option(..., "--build_id", "-b", help="ID of the build log to delete")
99
+ ) -> None:
100
+ """
101
+ Deletes a Docker build log entry by a specified build ID.
102
+
103
+ Args:
104
+ build_id (str): The unique identifier of the Docker build log to delete.
105
+
106
+ This command sends a request to delete a Docker build log identified by the provided build ID.
107
+ """
108
+ client = AdminClient()
109
+
110
+ console.print(client.delete_docker_build_logs(build_id))
111
+
112
+
113
+ if __name__ == "__main__":
114
+ buildlogs_app()
qbraid_cli/jobs/app.py CHANGED
@@ -75,18 +75,16 @@ def jobs_state(
75
75
  max_lib_length = max((len(lib) for lib in state_values.keys()), default=len(header_1))
76
76
  padding = max_lib_length + 9
77
77
 
78
- output = ""
78
+ console.print(f"Executable: {python_exe}")
79
+ console.print(f"\n{header_1:<{padding}}{header_2}", style="bold")
80
+
79
81
  for lib, (installed, enabled) in state_values.items():
80
82
  state_str = (
81
83
  "[green]enabled"
82
84
  if enabled and installed
83
85
  else "[red]disabled" if installed else "[grey70]unavailable"
84
86
  )
85
- output += f"{lib:<{padding-1}} {state_str}\n"
86
-
87
- console.print(f"Executable: {python_exe}")
88
- console.print(f"\n{header_1:<{padding}}{header_2}", style="bold")
89
- console.print(output)
87
+ console.print(f"{lib:<{padding-1}}", state_str, end="\n")
90
88
 
91
89
 
92
90
  @jobs_app.command(name="list")
@@ -157,6 +157,18 @@ def enable_braket(auto_confirm: bool = False):
157
157
  aws_configure_dummy() # TODO: possibly add another confirmation for writing aws config files
158
158
 
159
159
  try:
160
+ subprocess.check_call(
161
+ [
162
+ python_exe,
163
+ "-m",
164
+ "pip",
165
+ "install",
166
+ "amazon-braket-sdk",
167
+ "--upgrade",
168
+ "--upgrade-strategy",
169
+ "eager",
170
+ ]
171
+ )
160
172
  subprocess.check_call([python_exe, "-m", "pip", "install", f"boto3=={target}"])
161
173
  subprocess.check_call([python_exe, "-m", "pip", "uninstall", "botocore", "-y", "--quiet"])
162
174
  subprocess.check_call(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.8.5
3
+ Version: 0.8.5a1
4
4
  Summary: Command Line Interface for interacting with all parts of the qBraid platform.
5
5
  Author-email: qBraid Development Team <contact@qbraid.com>
6
6
  License: Proprietary
@@ -28,7 +28,7 @@ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: typer>=0.12.1
30
30
  Requires-Dist: rich>=10.11.0
31
- Requires-Dist: qbraid-core[environments]>=0.1.23
31
+ Requires-Dist: qbraid-core[environments]>=0.1.17
32
32
  Provides-Extra: dev
33
33
  Requires-Dist: ruff; extra == "dev"
34
34
  Requires-Dist: isort; extra == "dev"
@@ -1,11 +1,12 @@
1
1
  qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- qbraid_cli/_version.py,sha256=kTFCF-nxarUjJsdBGaHE-KQ5vwD07oUlc-DlqEskLt0,411
2
+ qbraid_cli/_version.py,sha256=BHnG9tsHsfJe-y6G4hSRrcmypIS_uApyUe_ZjgzdMgQ,413
3
3
  qbraid_cli/exceptions.py,sha256=KjlhYJhSHMVazaNiBjD_Ur06w4sekP8zRsFzBdyIpno,672
4
4
  qbraid_cli/handlers.py,sha256=3RTG5FHL5GTyDoBUv81x5sLyqwf8nzkcqBi0k1ayoW8,7034
5
5
  qbraid_cli/main.py,sha256=AR6qp2hU_3OEg1_RxRSfZkO2ZC3H4z-dz3hzaqeAl-I,2620
6
6
  qbraid_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  qbraid_cli/admin/__init__.py,sha256=qcWD5mQEUCtr49mrUpZmk7eGDe0L_Gtc8RwZmzIXSwo,175
8
- qbraid_cli/admin/app.py,sha256=yaIghXQygv0rcS586LCpBsZJ-S2uHUyzi-79lXTgZvU,1323
8
+ qbraid_cli/admin/app.py,sha256=9j2Jn4ICe08aggK4ELDGMO5eusfUECaUiRDrKGdtx6k,1429
9
+ qbraid_cli/admin/buildlogs.py,sha256=1i7CRpkIHIcKgGvHesPr9duCkyV7M-MESaHI5Z3ZdD0,3578
9
10
  qbraid_cli/admin/headers.py,sha256=xsx10Mq1SVpTMeef5HOdnXxxOo3Uj5l_k0yHiCWxQug,6429
10
11
  qbraid_cli/admin/validation.py,sha256=U_8RFWBwRUNPe6LdjNpl-Yz8Br57PLWMoPbpR-jBS-M,979
11
12
  qbraid_cli/configure/__init__.py,sha256=YaJ74Ztz2vl3eYp8_jVBucWkXscxz7EZEIzr70OfuOM,187
@@ -22,17 +23,17 @@ qbraid_cli/envs/app.py,sha256=kbSbZSnl09HI_VqfL5S07ozTvdBrHCOYO8i0msEn7xU,8440
22
23
  qbraid_cli/envs/create.py,sha256=xudzkLCNegY34zkXN_Vfl_0zVzg_tW83LcVx9quoWfU,988
23
24
  qbraid_cli/envs/data_handling.py,sha256=Ibnp2yJoUDpivb_sNqi0suYgJZNat_LmM6Ya0Ovez5s,1288
24
25
  qbraid_cli/jobs/__init__.py,sha256=qVLRHYIzP4XHpx_QWP_vCzd3LsCscCORaEx-Vcbx29U,172
25
- qbraid_cli/jobs/app.py,sha256=BOd3wPCf9gx3WMraZ0f7oDIjGTYhtwqUUimtjF5cUtk,4915
26
- qbraid_cli/jobs/toggle_braket.py,sha256=fMw4SOGfNTuoMvMXzxUzVz02nCkYlUddlobv9vMLkhg,7445
26
+ qbraid_cli/jobs/app.py,sha256=dpRrK6dyVgir9gfJeEzTibABf4JsB6STl0-WLX3ccTM,4885
27
+ qbraid_cli/jobs/toggle_braket.py,sha256=581ddmPtH2y9LwJSqppq8I2PujWBCf1tSk8UNrqehL4,7743
27
28
  qbraid_cli/jobs/validation.py,sha256=zMuBGsyx06GWTTgnmyousYYK-qx3IxYTwm0MkPkAWrc,2970
28
29
  qbraid_cli/kernels/__init__.py,sha256=jORS9vV17s5laQyq8gSVB18EPBImgEIbMZ1wKC094DA,181
29
30
  qbraid_cli/kernels/app.py,sha256=FedFpQBvK-5Fk7PTGskCHz0l8zIb7E7ex8M6UzobfKA,2923
30
31
  qbraid_cli/pip/__init__.py,sha256=tJtU0rxn-ODogNh5Y4pp_BgDQXMN-3JY1QGj0OZHwjQ,169
31
32
  qbraid_cli/pip/app.py,sha256=Cer_Tteo_k26bTNiLUX2k-XhdSU3wKuj9ZLubbGv7r4,1439
32
33
  qbraid_cli/pip/hooks.py,sha256=7LeK-vUbM_car_RPxKxQKx3Jb5mOe7SOGEcJjoGp45s,2123
33
- qbraid_cli-0.8.5.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
34
- qbraid_cli-0.8.5.dist-info/METADATA,sha256=LZ7WYtncI1c0T_ztxhgrWCWPEvvBTVlJ2_E4w45a3Q8,6705
35
- qbraid_cli-0.8.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
36
- qbraid_cli-0.8.5.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
37
- qbraid_cli-0.8.5.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
38
- qbraid_cli-0.8.5.dist-info/RECORD,,
34
+ qbraid_cli-0.8.5a1.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
35
+ qbraid_cli-0.8.5a1.dist-info/METADATA,sha256=Ksc1VOXvVOy2JRWdLXIxOo8iwvImNRceC6md9uuMjw8,6707
36
+ qbraid_cli-0.8.5a1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
37
+ qbraid_cli-0.8.5a1.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
38
+ qbraid_cli-0.8.5a1.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
39
+ qbraid_cli-0.8.5a1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (73.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5