qbraid-cli 0.8.5a2__py3-none-any.whl → 0.8.7__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 qbraid-cli might be problematic. Click here for more details.

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.5a2'
16
- __version_tuple__ = version_tuple = (0, 8, 5)
15
+ __version__ = version = '0.8.7'
16
+ __version_tuple__ = version_tuple = (0, 8, 7)
qbraid_cli/admin/app.py CHANGED
@@ -5,16 +5,17 @@
5
5
  Module defining commands in the 'qbraid admin' namespace.
6
6
 
7
7
  """
8
+
9
+ from typing import Optional
10
+
8
11
  import typer
9
12
 
10
- from qbraid_cli.admin.buildlogs import buildlogs_app
11
13
  from qbraid_cli.admin.headers import check_and_fix_headers
12
14
  from qbraid_cli.admin.validation import validate_header_type, validate_paths_exist
13
15
 
14
16
  admin_app = typer.Typer(
15
17
  help="CI/CD commands for qBraid maintainers.", pretty_exceptions_show_locals=False
16
18
  )
17
- admin_app.add_typer(buildlogs_app, name="buildlogs")
18
19
 
19
20
 
20
21
  @admin_app.command(name="headers")
@@ -35,12 +36,21 @@ def admin_headers(
35
36
  fix: bool = typer.Option(
36
37
  False, "--fix", "-f", help="Whether to fix the headers instead of just verifying."
37
38
  ),
39
+ project_name: Optional[str] = typer.Option(
40
+ "the qBraid-SDK", "--project", "-p", help="Name of the project to use in the header."
41
+ ),
38
42
  ):
39
43
  """
40
44
  Verifies and optionally fixes qBraid headers in specified files and directories.
41
45
 
42
46
  """
43
- check_and_fix_headers(src_paths, header_type=header_type, skip_files=skip_files, fix=fix)
47
+ check_and_fix_headers(
48
+ src_paths,
49
+ header_type=header_type,
50
+ skip_files=skip_files,
51
+ fix=fix,
52
+ project_name=project_name,
53
+ )
44
54
 
45
55
 
46
56
  if __name__ == "__main__":
@@ -5,6 +5,7 @@
5
5
  Script to verify qBraid copyright file headers
6
6
 
7
7
  """
8
+
8
9
  import os
9
10
  from typing import Optional
10
11
 
@@ -21,13 +22,13 @@ DEFAULT_HEADER = """# Copyright (c) 2024, qBraid Development Team
21
22
 
22
23
  DEFAULT_HEADER_GPL = """# Copyright (C) 2024 qBraid
23
24
  #
24
- # This file is part of the qBraid-SDK
25
+ # This file is part of {project_name}
25
26
  #
26
- # The qBraid-SDK is free software released under the GNU General Public License v3
27
+ # {project_name_start} is free software released under the GNU General Public License v3
27
28
  # or later. You can redistribute and/or modify it under the terms of the GPL v3.
28
29
  # See the LICENSE file in the project root or <https://www.gnu.org/licenses/gpl-3.0.html>.
29
30
  #
30
- # THERE IS NO WARRANTY for the qBraid-SDK, as per Section 15 of the GPL v3.
31
+ # THERE IS NO WARRANTY for {project_name}, as per Section 15 of the GPL v3.
31
32
  """
32
33
 
33
34
  HEADER_TYPES = {
@@ -36,15 +37,35 @@ HEADER_TYPES = {
36
37
  }
37
38
 
38
39
 
40
+ def get_formatted_header(header_type: str, project_name: str) -> str:
41
+ """Get the formatted header based on the header type
42
+
43
+ Args:
44
+ header_type (str): The type of header to use.
45
+ project_name (str): The name of the project to use in the header.
46
+
47
+ Returns:
48
+ str: The formatted header
49
+ """
50
+
51
+ header = HEADER_TYPES[header_type]
52
+ if header_type == "gpl":
53
+ return header.format(
54
+ project_name=project_name, project_name_start=project_name[0].upper() + project_name[1:]
55
+ )
56
+ return header
57
+
58
+
39
59
  def check_and_fix_headers(
40
60
  src_paths: list[str],
41
61
  header_type: str = "default",
42
62
  skip_files: Optional[list[str]] = None,
43
63
  fix: bool = False,
64
+ project_name: Optional[str] = None,
44
65
  ) -> None:
45
66
  """Script to add or verify qBraid copyright file headers"""
46
67
  try:
47
- header = HEADER_TYPES[header_type]
68
+ header = get_formatted_header(header_type, project_name)
48
69
  except KeyError:
49
70
  handle_error(
50
71
  error_type="ValueError",
@@ -139,7 +160,10 @@ def check_and_fix_headers(
139
160
  replace_or_add_header(item, fix)
140
161
  checked += 1
141
162
  else:
142
- handle_error(error_type="FileNotFoundError", message=f"Path '{item}' does not exist.")
163
+ if not os.path.isfile(item):
164
+ handle_error(
165
+ error_type="FileNotFoundError", message=f"Path '{item}' does not exist."
166
+ )
143
167
 
144
168
  if checked == 0:
145
169
  console.print("[bold]No Python files present. Nothing to do[/bold] 😴")
qbraid_cli/envs/app.py CHANGED
@@ -241,7 +241,9 @@ def envs_list():
241
241
 
242
242
  @envs_app.command(name="activate")
243
243
  def envs_activate(
244
- name: str = typer.Argument(..., help="Name of the environment. Values from 'qbraid envs list'.")
244
+ name: str = typer.Argument(
245
+ ..., help="Name of the environment. Values from 'qbraid envs list'."
246
+ ),
245
247
  ):
246
248
  """Activate qBraid environment.
247
249
 
qbraid_cli/jobs/app.py CHANGED
@@ -5,6 +5,7 @@
5
5
  Module defining commands in the 'qbraid jobs' namespace.
6
6
 
7
7
  """
8
+
8
9
  from typing import Any, Callable
9
10
 
10
11
  import typer
@@ -63,7 +64,7 @@ def jobs_state(
63
64
  default=None,
64
65
  help="Optional: Specify a software library with quantum jobs support to check its status.",
65
66
  callback=validate_library,
66
- )
67
+ ),
67
68
  ) -> None:
68
69
  """Display the state of qBraid Quantum Jobs for the current environment."""
69
70
  result: tuple[str, dict[str, tuple[bool, bool]]] = run_progress_get_state(library)
@@ -93,7 +94,7 @@ def jobs_state(
93
94
  def jobs_list(
94
95
  limit: int = typer.Option(
95
96
  10, "--limit", "-l", help="Limit the maximum number of results returned"
96
- )
97
+ ),
97
98
  ) -> None:
98
99
  """List qBraid Quantum Jobs."""
99
100
 
@@ -5,6 +5,7 @@
5
5
  Module supporting 'qbraid jobs enable/disable braket' and commands.
6
6
 
7
7
  """
8
+
8
9
  import logging
9
10
  import os
10
11
  import re
@@ -5,6 +5,7 @@
5
5
  Module for validating command arguments for qBraid Quantum Jobs.
6
6
 
7
7
  """
8
+
8
9
  import sys
9
10
  from typing import Any, Callable, Optional
10
11
 
qbraid_cli/kernels/app.py CHANGED
@@ -5,6 +5,7 @@
5
5
  Module defining commands in the 'qbraid kernels' namespace.
6
6
 
7
7
  """
8
+
8
9
  import typer
9
10
  from rich.console import Console
10
11
 
@@ -55,7 +56,7 @@ def kernels_list():
55
56
  def kernels_add(
56
57
  environment: str = typer.Argument(
57
58
  ..., help="Name of environment for which to add ipykernel. Values from 'qbraid envs list'."
58
- )
59
+ ),
59
60
  ):
60
61
  """Add a kernel."""
61
62
  from qbraid_core.services.environments.kernels import add_kernels
@@ -77,7 +78,7 @@ def kernels_remove(
77
78
  environment: str = typer.Argument(
78
79
  ...,
79
80
  help=("Name of environment for which to remove ipykernel. Values from 'qbraid envs list'."),
80
- )
81
+ ),
81
82
  ):
82
83
  """Remove a kernel."""
83
84
  from qbraid_core.services.environments.kernels import remove_kernels
qbraid_cli/pip/app.py CHANGED
@@ -5,6 +5,7 @@
5
5
  Module defining commands in the 'qbraid pip' namespace.
6
6
 
7
7
  """
8
+
8
9
  import subprocess
9
10
  import sys
10
11
 
qbraid_cli/pip/hooks.py CHANGED
@@ -5,6 +5,7 @@
5
5
  Module defining pre- and post-command hooks for the 'qbraid pip' namespace.
6
6
 
7
7
  """
8
+
8
9
  import sys
9
10
  from pathlib import Path
10
11
  from typing import Optional, Union
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.8.5a2
3
+ Version: 0.8.7
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
@@ -23,12 +23,13 @@ Classifier: Programming Language :: Python :: 3.9
23
23
  Classifier: Programming Language :: Python :: 3.10
24
24
  Classifier: Programming Language :: Python :: 3.11
25
25
  Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
26
27
  Requires-Python: >=3.9
27
28
  Description-Content-Type: text/markdown
28
29
  License-File: LICENSE
29
30
  Requires-Dist: typer>=0.12.1
30
31
  Requires-Dist: rich>=10.11.0
31
- Requires-Dist: qbraid-core[environments]>=0.1.17
32
+ Requires-Dist: qbraid-core[environments]>=0.1.23
32
33
  Provides-Extra: dev
33
34
  Requires-Dist: ruff; extra == "dev"
34
35
  Requires-Dist: isort; extra == "dev"
@@ -1,13 +1,12 @@
1
1
  qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- qbraid_cli/_version.py,sha256=-l9i05IAj65GCXJkpqaDdqtu17FqPMAEy1_eI1jnsd4,413
2
+ qbraid_cli/_version.py,sha256=0QaoDrtVNX8IGUA-uad1zNdiF53ernxhfjc0x5jK3hs,411
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=9j2Jn4ICe08aggK4ELDGMO5eusfUECaUiRDrKGdtx6k,1429
9
- qbraid_cli/admin/buildlogs.py,sha256=1i7CRpkIHIcKgGvHesPr9duCkyV7M-MESaHI5Z3ZdD0,3578
10
- qbraid_cli/admin/headers.py,sha256=xsx10Mq1SVpTMeef5HOdnXxxOo3Uj5l_k0yHiCWxQug,6429
8
+ qbraid_cli/admin/app.py,sha256=NGisg2aouk8qK2oFogwblFTBK0vvTiL_zJYjeanC4x0,1576
9
+ qbraid_cli/admin/headers.py,sha256=WqpRYp81CQcF5-Afumo_qQrf-5XCfbndBJ6I7vOADKE,7133
11
10
  qbraid_cli/admin/validation.py,sha256=U_8RFWBwRUNPe6LdjNpl-Yz8Br57PLWMoPbpR-jBS-M,979
12
11
  qbraid_cli/configure/__init__.py,sha256=YaJ74Ztz2vl3eYp8_jVBucWkXscxz7EZEIzr70OfuOM,187
13
12
  qbraid_cli/configure/actions.py,sha256=-BduRmnxvf8JMNonb6VWFtdlHlcHPOPz3Bj5g8kfmBU,3197
@@ -19,21 +18,21 @@ qbraid_cli/devices/app.py,sha256=3Ly5PPNVhipzbX2h3FrB3fWawLbUcQFcUqv_cZv5eYk,252
19
18
  qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcNam4,809
20
19
  qbraid_cli/envs/__init__.py,sha256=1-cMvrATsddYxcetPJWxq6bEOqJWMktGdhoZ4qm8euA,172
21
20
  qbraid_cli/envs/activate.py,sha256=VpvVYSfQDlcmlNWJOgkLIQ2p8YXPPLG8Jbl5t8GHUDw,2140
22
- qbraid_cli/envs/app.py,sha256=kbSbZSnl09HI_VqfL5S07ozTvdBrHCOYO8i0msEn7xU,8440
21
+ qbraid_cli/envs/app.py,sha256=5bb6OQUgcyCPw0REqEyjFHrjqsuhEn8zCsI3d6abgpI,8455
23
22
  qbraid_cli/envs/create.py,sha256=xudzkLCNegY34zkXN_Vfl_0zVzg_tW83LcVx9quoWfU,988
24
23
  qbraid_cli/envs/data_handling.py,sha256=Ibnp2yJoUDpivb_sNqi0suYgJZNat_LmM6Ya0Ovez5s,1288
25
24
  qbraid_cli/jobs/__init__.py,sha256=qVLRHYIzP4XHpx_QWP_vCzd3LsCscCORaEx-Vcbx29U,172
26
- qbraid_cli/jobs/app.py,sha256=BOd3wPCf9gx3WMraZ0f7oDIjGTYhtwqUUimtjF5cUtk,4915
27
- qbraid_cli/jobs/toggle_braket.py,sha256=fMw4SOGfNTuoMvMXzxUzVz02nCkYlUddlobv9vMLkhg,7445
28
- qbraid_cli/jobs/validation.py,sha256=zMuBGsyx06GWTTgnmyousYYK-qx3IxYTwm0MkPkAWrc,2970
25
+ qbraid_cli/jobs/app.py,sha256=veyY5aunlPaDYCVmAHmEtaIo_veUVWRXmCB_GBJHEuQ,4918
26
+ qbraid_cli/jobs/toggle_braket.py,sha256=lQOG6h39vG3JsRh90LuJ8g_3hNuMSq8jdpRjjBG6SyQ,7446
27
+ qbraid_cli/jobs/validation.py,sha256=KlkqVH1-vlNCHSayEpxzyXU86_TMN5prGfMFEoyBsFs,2971
29
28
  qbraid_cli/kernels/__init__.py,sha256=jORS9vV17s5laQyq8gSVB18EPBImgEIbMZ1wKC094DA,181
30
- qbraid_cli/kernels/app.py,sha256=FedFpQBvK-5Fk7PTGskCHz0l8zIb7E7ex8M6UzobfKA,2923
29
+ qbraid_cli/kernels/app.py,sha256=Sl57U1JXDKWoeMQDSXJRHlKzDYSdKIbV7tSytZXo5PM,2926
31
30
  qbraid_cli/pip/__init__.py,sha256=tJtU0rxn-ODogNh5Y4pp_BgDQXMN-3JY1QGj0OZHwjQ,169
32
- qbraid_cli/pip/app.py,sha256=Cer_Tteo_k26bTNiLUX2k-XhdSU3wKuj9ZLubbGv7r4,1439
33
- qbraid_cli/pip/hooks.py,sha256=7LeK-vUbM_car_RPxKxQKx3Jb5mOe7SOGEcJjoGp45s,2123
34
- qbraid_cli-0.8.5a2.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
35
- qbraid_cli-0.8.5a2.dist-info/METADATA,sha256=t2ce2gIUvpaHCIezclGesvJMVFFVm8JzO0X3KuUMoks,6707
36
- qbraid_cli-0.8.5a2.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
37
- qbraid_cli-0.8.5a2.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
38
- qbraid_cli-0.8.5a2.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
39
- qbraid_cli-0.8.5a2.dist-info/RECORD,,
31
+ qbraid_cli/pip/app.py,sha256=wzvjX5NL37XIFtZ5KvTZ-nj9xwFKt8QLYZ_vGvk3tXo,1440
32
+ qbraid_cli/pip/hooks.py,sha256=jkIeev3cOd-cmaoJSdSqbmhTYCs6z1we84FMqa3ZoZw,2124
33
+ qbraid_cli-0.8.7.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
34
+ qbraid_cli-0.8.7.dist-info/METADATA,sha256=nmRUjBjDDbFmEuAe56_Ino1NQBac3yyNz3azdpLMx_U,6756
35
+ qbraid_cli-0.8.7.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
36
+ qbraid_cli-0.8.7.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
37
+ qbraid_cli-0.8.7.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
38
+ qbraid_cli-0.8.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.1)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,114 +0,0 @@
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()