qbraid-cli 0.9.6__py3-none-any.whl → 0.9.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.9.6'
16
- __version_tuple__ = version_tuple = (0, 9, 6)
15
+ __version__ = version = '0.9.7'
16
+ __version_tuple__ = version_tuple = (0, 9, 7)
qbraid_cli/admin/app.py CHANGED
@@ -10,8 +10,8 @@ from typing import Optional
10
10
 
11
11
  import typer
12
12
 
13
- from qbraid_cli.admin.headers import check_and_fix_headers
14
- from qbraid_cli.admin.validation import validate_header_type, validate_paths_exist
13
+ from qbraid_cli.admin.headers import HeaderType, check_and_fix_headers
14
+ from qbraid_cli.admin.validation import validate_paths_exist
15
15
 
16
16
  admin_app = typer.Typer(
17
17
  help="CI/CD commands for qBraid maintainers.",
@@ -25,12 +25,8 @@ def admin_headers(
25
25
  src_paths: list[str] = typer.Argument(
26
26
  ..., help="Source file or directory paths to verify.", callback=validate_paths_exist
27
27
  ),
28
- header_type: str = typer.Option(
29
- "default",
30
- "--type",
31
- "-t",
32
- help="Type of header to use ('default' or 'gpl').",
33
- callback=validate_header_type,
28
+ header_type: HeaderType = typer.Option(
29
+ "default", "--type", "-t", help="Type of header to use."
34
30
  ),
35
31
  skip_files: list[str] = typer.Option(
36
32
  [], "--skip", "-s", help="Files to skip during verification.", callback=validate_paths_exist
@@ -1,6 +1,8 @@
1
1
  # Copyright (c) 2024, qBraid Development Team
2
2
  # All rights reserved.
3
3
 
4
+ # pylint: disable=too-many-branches,too-many-statements
5
+
4
6
  """
5
7
  Script to verify qBraid copyright file headers
6
8
 
@@ -8,6 +10,8 @@ Script to verify qBraid copyright file headers
8
10
 
9
11
  import datetime
10
12
  import os
13
+ from enum import Enum
14
+ from pathlib import Path
11
15
  from typing import Optional
12
16
 
13
17
  import typer
@@ -15,36 +19,47 @@ from rich.console import Console
15
19
 
16
20
  from qbraid_cli.handlers import handle_error
17
21
 
18
- # pylint: disable=too-many-branches,too-many-statements
19
22
  CURR_YEAR = datetime.datetime.now().year
20
23
  PREV_YEAR = CURR_YEAR - 1
21
- VALID_EXTS = (".py", ".js", ".ts")
22
24
 
25
+ COMMENT_MARKER = {
26
+ ".py": "#",
27
+ ".js": "//",
28
+ ".ts": "//",
29
+ }
30
+
31
+ VALID_EXTS = tuple(COMMENT_MARKER.keys())
32
+
33
+
34
+ class HeaderType(Enum):
35
+ """Type of header to use."""
36
+
37
+ default = "default" # pylint: disable=invalid-name
38
+ gpl = "gpl" # pylint: disable=invalid-name
23
39
 
24
- DEFAULT_HEADER = f"""# Copyright (c) {str(CURR_YEAR)}, qBraid Development Team
40
+
41
+ DEFAULT_HEADER = f"""# Copyright (c) {CURR_YEAR}, qBraid Development Team
25
42
  # All rights reserved.
26
43
  """
27
44
 
28
- DEFAULT_HEADER_GPL = (
29
- f"""# Copyright (C) {str(CURR_YEAR)} qBraid"""
30
- + """#
31
- # This file is part of {project_name}
45
+ DEFAULT_HEADER_GPL = f"""# Copyright (C) {CURR_YEAR} qBraid
46
+ #
47
+ # This file is part of {{project_name}}
32
48
  #
33
- # {project_name_start} is free software released under the GNU General Public License v3
49
+ # {{project_name_start}} is free software released under the GNU General Public License v3
34
50
  # or later. You can redistribute and/or modify it under the terms of the GPL v3.
35
51
  # See the LICENSE file in the project root or <https://www.gnu.org/licenses/gpl-3.0.html>.
36
52
  #
37
- # THERE IS NO WARRANTY for {project_name}, as per Section 15 of the GPL v3.
53
+ # THERE IS NO WARRANTY for {{project_name}}, as per Section 15 of the GPL v3.
38
54
  """
39
- )
40
55
 
41
56
  HEADER_TYPES = {
42
- "default": DEFAULT_HEADER,
43
- "gpl": DEFAULT_HEADER_GPL,
57
+ HeaderType.default: DEFAULT_HEADER,
58
+ HeaderType.gpl: DEFAULT_HEADER_GPL,
44
59
  }
45
60
 
46
61
 
47
- def get_formatted_header(header_type: str, project_name: str) -> str:
62
+ def get_formatted_header(header_type: HeaderType, project_name: str) -> str:
48
63
  """Get the formatted header based on the header type
49
64
 
50
65
  Args:
@@ -56,16 +71,24 @@ def get_formatted_header(header_type: str, project_name: str) -> str:
56
71
  """
57
72
 
58
73
  header = HEADER_TYPES[header_type]
59
- if header_type == "gpl":
60
- return header.format(
61
- project_name=project_name, project_name_start=project_name[0].upper() + project_name[1:]
62
- )
74
+ if header_type == HeaderType.gpl:
75
+ if project_name.split(" ")[0].lower() == "the":
76
+ project_name = project_name[:1].lower() + project_name[1:]
77
+ project_name_start = project_name[:1].upper() + project_name[1:]
78
+ else:
79
+ project_name_start = project_name
80
+ return header.format(project_name=project_name, project_name_start=project_name_start)
63
81
  return header
64
82
 
65
83
 
84
+ def _get_comment_marker(file_path: str, default: Optional[str] = None) -> str:
85
+ file_ext = Path(file_path).suffix
86
+ return COMMENT_MARKER.get(file_ext, default)
87
+
88
+
66
89
  def check_and_fix_headers(
67
90
  src_paths: list[str],
68
- header_type: str = "default",
91
+ header_type: HeaderType = HeaderType.default,
69
92
  skip_files: Optional[list[str]] = None,
70
93
  fix: bool = False,
71
94
  project_name: Optional[str] = None,
@@ -74,11 +97,10 @@ def check_and_fix_headers(
74
97
  try:
75
98
  header = get_formatted_header(header_type, project_name)
76
99
  except KeyError:
100
+ members = HeaderType._member_names_ # pylint: disable=no-member,protected-access
77
101
  handle_error(
78
102
  error_type="ValueError",
79
- message=(
80
- f"Invalid header type: {HEADER_TYPES}. Expected one of {list(HEADER_TYPES.keys())}"
81
- ),
103
+ message=(f"Invalid header type: {HEADER_TYPES}. Expected one of {members}"),
82
104
  )
83
105
 
84
106
  for path in src_paths:
@@ -101,7 +123,8 @@ def check_and_fix_headers(
101
123
  if os.path.basename(file_path) == "__init__.py":
102
124
  return not content.strip()
103
125
 
104
- skip_header_tag = "# qbraid: skip-header"
126
+ comment_marker = _get_comment_marker(file_path)
127
+ skip_header_tag = f"{comment_marker} qbraid: skip-header"
105
128
  line_number = 0
106
129
 
107
130
  for line in content.splitlines():
@@ -117,13 +140,7 @@ def check_and_fix_headers(
117
140
  with open(file_path, "r", encoding="ISO-8859-1") as f:
118
141
  content = f.read()
119
142
 
120
- # Get the file extension
121
- file_ext = os.path.splitext(file_path)[1]
122
-
123
- if file_ext == ".py":
124
- comment_marker = "#"
125
- elif file_ext in (".js", ".ts"):
126
- comment_marker = "//"
143
+ comment_marker = _get_comment_marker(file_path)
127
144
 
128
145
  # This finds the start of the actual content after skipping initial whitespace and comments.
129
146
  lines = content.splitlines()
@@ -10,14 +10,7 @@ import os
10
10
 
11
11
  import typer
12
12
 
13
- from qbraid_cli.admin.headers import HEADER_TYPES
14
- from qbraid_cli.handlers import _format_list_items, validate_item
15
-
16
-
17
- def validate_header_type(value: str) -> str:
18
- """Validate header type."""
19
- header_types = list(HEADER_TYPES.keys())
20
- return validate_item(value, header_types, "Header type")
13
+ from qbraid_cli.handlers import _format_list_items
21
14
 
22
15
 
23
16
  def validate_paths_exist(paths: list[str]) -> list[str]:
@@ -79,7 +79,7 @@ def configure_get(
79
79
 
80
80
  @configure_app.command(name="list")
81
81
  def configure_list():
82
- """List all configuration values in the default profile."""
82
+ """List all configuration values in qbraidrc."""
83
83
  # pylint: disable-next=import-outside-toplevel
84
84
  from qbraid_core.config import load_config
85
85
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: qbraid-cli
3
- Version: 0.9.6
3
+ Version: 0.9.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
@@ -52,7 +52,11 @@ Requires-Dist: pytest-cov; extra == "dev"
52
52
 
53
53
  Command Line Interface for interacting with all parts of the qBraid platform.
54
54
 
55
- The **qBraid CLI** is a versatile command-line interface tool designed for seamless interaction with qBraid cloud services and quantum software management tools. Initially exclusive to the [qBraid Lab](https://docs.qbraid.com/lab/user-guide/overview) platform, the CLI now supports local installations as well. This enhancement broadens access to features like [qBraid Quantum Jobs](https://docs.qbraid.com/cli/user-guide/quantum-jobs), enabling direct acess to QPU devices from leading providers like IonQ, Oxford Quantum Circuits, QuEra, Rigetti, and IQM, as well as on-demand simulators from qBraid and AWS, all using qBraid [credits](https://docs.qbraid.com/home/pricing), with no additional access keys required.
55
+ The **qBraid CLI** is a versatile command-line interface tool designed for seamless interaction with qBraid cloud services and quantum software management tools. Initially exclusive to the [qBraid Lab](https://docs.qbraid.com/lab/user-guide/overview) platform, the CLI now supports local installations as well. This enhancement broadens access to features like [qBraid Quantum Jobs](https://docs.qbraid.com/cli/user-guide/quantum-jobs), enabling direct, pre-configured access to QPUs from IonQ, Oxford Quantum Circuits, QuEra, Rigetti, and IQM, as well as on-demand simulators from qBraid, AWS, IonQ, QuEra, and NEC. See [pricing](https://docs.qbraid.com/home/pricing) for more.
56
+
57
+ *Resources*:
58
+ - [User Guide](https://docs.qbraid.com/cli/user-guide/overview)
59
+ - [API Reference](https://docs.qbraid.com/cli/api-reference/qbraid)
56
60
 
57
61
  ## Getting Started
58
62
 
@@ -69,6 +73,12 @@ You can also install the qBraid-CLI from PyPI with:
69
73
  pip install qbraid-cli
70
74
  ```
71
75
 
76
+ To manage qBraid [environments](https://docs.qbraid.com/lab/user-guide/environments) using the CLI, you must also install the `envs` extra:
77
+
78
+ ```bash
79
+ pip install 'qbraid-cli[envs]'
80
+ ```
81
+
72
82
  ## Local configuration
73
83
 
74
84
  After installation, you must configure your account credentials to use the CLI locally:
@@ -83,6 +93,8 @@ After installation, you must configure your account credentials to use the CLI l
83
93
  $ qbraid configure
84
94
  ```
85
95
 
96
+ For more on API keys, see [documentation](https://docs.qbraid.com/home/account#api-keys).
97
+
86
98
  ## Basic Commands
87
99
 
88
100
  ```bash
@@ -142,12 +154,17 @@ Options
142
154
  --help Show this message and exit.
143
155
 
144
156
  Commands
157
+ account Manage qBraid account
158
+ admin CI/CD commands for qBraid maintainers.
145
159
  configure Configure qBraid CLI options.
146
160
  account Manage qBraid account.
161
+ chat Interact with qBraid AI chat service.
147
162
  devices Manage qBraid quantum devices.
148
163
  envs Manage qBraid environments.
164
+ files Manage qBraid cloud storage files.
149
165
  jobs Manage qBraid quantum jobs.
150
166
  kernels Manage qBraid kernels.
167
+ pip Run pip command in active qBraid environment.
151
168
  ```
152
169
 
153
170
  To get the version of the qBraid CLI:
@@ -173,7 +190,5 @@ In [1]: %load_ext qbraid_magic
173
190
  Now you can continue to use the qBraid-CLI as normal from within your Jupyter notebook using the magic ``%`` operator, e.g.
174
191
 
175
192
  ```python
176
- In [2]: %qbraid jobs state
177
-
178
- In [3]: %qbraid jobs enable braket -y
193
+ In [2]: %qbraid chat -f code -p "Write a Qiskit bell circuit"
179
194
  ```
@@ -1,5 +1,5 @@
1
1
  qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- qbraid_cli/_version.py,sha256=11ciOFzse5i9Y6lr7kosD6U2UdIm5Bsf7hdpK0Hg_2I,411
2
+ qbraid_cli/_version.py,sha256=4XC29QIe8f6Nj4TIXVcWdhsy0tKD5guALT5XGZC9sso,411
3
3
  qbraid_cli/exceptions.py,sha256=KjlhYJhSHMVazaNiBjD_Ur06w4sekP8zRsFzBdyIpno,672
4
4
  qbraid_cli/handlers.py,sha256=B9H1Qw6yx8izrqp9OGR2TgSJa_mxA8KLXUkX8LB7Feg,7650
5
5
  qbraid_cli/main.py,sha256=aSOQyoRRvKBJBcx8VtU4zKZ2WHvGKHhw8I-WiRwPxcE,3926
@@ -7,14 +7,14 @@ qbraid_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  qbraid_cli/account/__init__.py,sha256=smlpUcVkM3QEbJG0norGM7i71XBJlUGQYByswTfPnmg,181
8
8
  qbraid_cli/account/app.py,sha256=1UogauwgX0Hnr7H6cBV2Qv-lT6aRpRLAimCyLi0afGI,1843
9
9
  qbraid_cli/admin/__init__.py,sha256=qcWD5mQEUCtr49mrUpZmk7eGDe0L_Gtc8RwZmzIXSwo,175
10
- qbraid_cli/admin/app.py,sha256=V2mgts3x3Vgsx_nbRwVrKF9PgZ9SuA10b8O9cjiphYE,1607
11
- qbraid_cli/admin/headers.py,sha256=OCZ690_rjJy8ppH4ogHjiQwHWJTcPnJT0KyIT0h6hkE,7732
12
- qbraid_cli/admin/validation.py,sha256=U_8RFWBwRUNPe6LdjNpl-Yz8Br57PLWMoPbpR-jBS-M,979
10
+ qbraid_cli/admin/app.py,sha256=YOVLUjKysUcvnhJF2HAhVHVKDNUJeZ-uMV81uQdzxkk,1519
11
+ qbraid_cli/admin/headers.py,sha256=kbrJTMf0JuO5yjZGiVwFhMhrzyAfLEeCXclMHwBcT68,8384
12
+ qbraid_cli/admin/validation.py,sha256=fhpttxupCGBk56ExQPuuQm8nMnptLLy_8sj-EjpM8g0,729
13
13
  qbraid_cli/chat/__init__.py,sha256=NO41vndEdfr0vDynNcmHFh-nhzWjnWqGm4M9parikck,258
14
14
  qbraid_cli/chat/app.py,sha256=-YqCLGDh4ezF149xB3dfuUAQotKAklZwYp0BL3HhA90,2256
15
15
  qbraid_cli/configure/__init__.py,sha256=YaJ74Ztz2vl3eYp8_jVBucWkXscxz7EZEIzr70OfuOM,187
16
16
  qbraid_cli/configure/actions.py,sha256=-BduRmnxvf8JMNonb6VWFtdlHlcHPOPz3Bj5g8kfmBU,3197
17
- qbraid_cli/configure/app.py,sha256=wNKOXi5GIuvVdp1G00IuOXVGvi-PpB31yaOu1bjinWQ,4175
17
+ qbraid_cli/configure/app.py,sha256=7UN8Bje0n_s2nDE-cHid8VwOp7gl0jjw9gldyCcZNhI,4164
18
18
  qbraid_cli/devices/__init__.py,sha256=hiScO-px6jCL5cJj5Hbty55EUfNejTO4bmqUZuS3aqc,181
19
19
  qbraid_cli/devices/app.py,sha256=q8AQ8o05JXODsaFR_16_S3UtLWPzwC2qi0bVw2h7RJ8,2543
20
20
  qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcNam4,809
@@ -34,9 +34,9 @@ qbraid_cli/kernels/app.py,sha256=n-iyWJHy7_ML6qk4pp-v_rQkGA7WfnZMG8gyiCFGO1c,294
34
34
  qbraid_cli/pip/__init__.py,sha256=tJtU0rxn-ODogNh5Y4pp_BgDQXMN-3JY1QGj0OZHwjQ,169
35
35
  qbraid_cli/pip/app.py,sha256=jkk-djductrDOJIRYfHK_7WDJ12f0zOT3MMkiZp97oM,1365
36
36
  qbraid_cli/pip/hooks.py,sha256=jkIeev3cOd-cmaoJSdSqbmhTYCs6z1we84FMqa3ZoZw,2124
37
- qbraid_cli-0.9.6.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
38
- qbraid_cli-0.9.6.dist-info/METADATA,sha256=mlBLxNdmCCn-tU2KGErGI1JRcH5mM1A7Q_ZL8Ru8O20,6806
39
- qbraid_cli-0.9.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
40
- qbraid_cli-0.9.6.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
41
- qbraid_cli-0.9.6.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
42
- qbraid_cli-0.9.6.dist-info/RECORD,,
37
+ qbraid_cli-0.9.7.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
38
+ qbraid_cli-0.9.7.dist-info/METADATA,sha256=rTuY3_2Gy__wGEEO0vM9kDZSWSpUVnFt-GIGpi7RZCg,7525
39
+ qbraid_cli-0.9.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
40
+ qbraid_cli-0.9.7.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
41
+ qbraid_cli-0.9.7.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
42
+ qbraid_cli-0.9.7.dist-info/RECORD,,