qbraid-cli 0.9.3__py3-none-any.whl → 0.9.4__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.3'
16
- __version_tuple__ = version_tuple = (0, 9, 3)
15
+ __version__ = version = '0.9.4'
16
+ __version_tuple__ = version_tuple = (0, 9, 4)
qbraid_cli/envs/app.py CHANGED
@@ -13,12 +13,13 @@ from pathlib import Path
13
13
  from typing import TYPE_CHECKING, Optional
14
14
 
15
15
  import typer
16
+ from qbraid_core.services.environments.schema import EnvironmentConfig
16
17
  from rich.console import Console
17
18
 
18
19
  from qbraid_cli.envs.create import create_qbraid_env_assets, create_venv
19
20
  from qbraid_cli.envs.data_handling import get_envs_data as installed_envs_data
20
21
  from qbraid_cli.envs.data_handling import validate_env_name
21
- from qbraid_cli.handlers import QbraidException, run_progress_task
22
+ from qbraid_cli.handlers import QbraidException, handle_error, run_progress_task
22
23
 
23
24
  if TYPE_CHECKING:
24
25
  from qbraid_core.services.environments.client import EnvironmentManagerClient as EMC
@@ -28,18 +29,51 @@ envs_app = typer.Typer(help="Manage qBraid environments.", no_args_is_help=True)
28
29
 
29
30
  @envs_app.command(name="create")
30
31
  def envs_create( # pylint: disable=too-many-statements
31
- name: str = typer.Option(
32
- ..., "--name", "-n", help="Name of the environment to create", callback=validate_env_name
33
- ),
32
+ name: str = typer.Option(None, "--name", "-n", help="Name of the environment to create"),
34
33
  description: Optional[str] = typer.Option(
35
34
  None, "--description", "-d", help="Short description of the environment"
36
35
  ),
36
+ file_path: str = typer.Option(
37
+ None, "--file", "-f", help="Path to a .yml file containing the environment details"
38
+ ),
37
39
  auto_confirm: bool = typer.Option(
38
40
  False, "--yes", "-y", help="Automatically answer 'yes' to all prompts"
39
41
  ),
40
42
  ) -> None:
41
43
  """Create a new qBraid environment."""
42
44
  env_description = description or ""
45
+ if name:
46
+ if not validate_env_name(name):
47
+ handle_error(
48
+ error_type="ValueError",
49
+ include_traceback=False,
50
+ message=f"Invalid environment name '{name}'. ",
51
+ )
52
+
53
+ env_details_in_cli = name is not None and env_description != ""
54
+ custom_env_data = None
55
+ if env_details_in_cli and file_path:
56
+ handle_error(
57
+ error_type="ArgumentConflictError",
58
+ include_traceback=False,
59
+ message="Cannot use --file with --name or --description while creating an environment",
60
+ )
61
+ elif not env_details_in_cli and not file_path:
62
+ handle_error(
63
+ error_type="MalformedCommandError",
64
+ include_traceback=False,
65
+ message="Must provide either --name and --description or --file "
66
+ "while creating an environment",
67
+ )
68
+ else:
69
+ try:
70
+ if file_path:
71
+ custom_env_data: EnvironmentConfig = EnvironmentConfig.from_yaml(file_path)
72
+ except ValueError as err:
73
+ handle_error(error_type="YamlValidationError", message=str(err))
74
+
75
+ if not name:
76
+ name = custom_env_data.name
43
77
 
44
78
  def create_environment(*args, **kwargs) -> "tuple[dict, EMC]":
45
79
  """Create a qBraid environment."""
@@ -65,10 +99,15 @@ def envs_create( # pylint: disable=too-many-statements
65
99
 
66
100
  return env_path, python_version
67
101
 
102
+ if not custom_env_data:
103
+ custom_env_data = EnvironmentConfig(
104
+ name=name,
105
+ description=env_description,
106
+ )
107
+
68
108
  environment, emc = run_progress_task(
69
109
  create_environment,
70
- name,
71
- env_description,
110
+ custom_env_data,
72
111
  description="Validating request...",
73
112
  error_message="Failed to create qBraid environment",
74
113
  )
@@ -78,6 +117,7 @@ def envs_create( # pylint: disable=too-many-statements
78
117
  description="Solving environment...",
79
118
  error_message="Failed to create qBraid environment",
80
119
  )
120
+
81
121
  slug = environment.get("slug")
82
122
  display_name = environment.get("displayName")
83
123
  prompt = environment.get("prompt")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.9.3
3
+ Version: 0.9.4
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
@@ -30,7 +30,7 @@ License-File: LICENSE
30
30
  Requires-Dist: typer>=0.12.1
31
31
  Requires-Dist: rich>=10.11.0
32
32
  Requires-Dist: click
33
- Requires-Dist: qbraid-core>=0.1.32
33
+ Requires-Dist: qbraid-core>=0.1.33
34
34
  Provides-Extra: jobs
35
35
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
36
36
  Provides-Extra: envs
@@ -1,5 +1,5 @@
1
1
  qbraid_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- qbraid_cli/_version.py,sha256=UKt4viYNHppvoM2VUu_oFmzU2bpc5MQ2Y0-6XGFMVuM,411
2
+ qbraid_cli/_version.py,sha256=N2r6Pxbr0xZx1XwnfGZ1tTgnRDaJpNzOV5NmOdJYA4A,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
@@ -20,7 +20,7 @@ qbraid_cli/devices/app.py,sha256=q8AQ8o05JXODsaFR_16_S3UtLWPzwC2qi0bVw2h7RJ8,254
20
20
  qbraid_cli/devices/validation.py,sha256=YhShyUufgrKnx2XjXOXF-PqFJYklJT9CgeqIwKcNam4,809
21
21
  qbraid_cli/envs/__init__.py,sha256=1-cMvrATsddYxcetPJWxq6bEOqJWMktGdhoZ4qm8euA,172
22
22
  qbraid_cli/envs/activate.py,sha256=VpvVYSfQDlcmlNWJOgkLIQ2p8YXPPLG8Jbl5t8GHUDw,2140
23
- qbraid_cli/envs/app.py,sha256=ug1myjrtYY0ukeT0mCJBFiRmnWqaWJCY-wclHS9TvMc,8469
23
+ qbraid_cli/envs/app.py,sha256=c3O5fB6PThCXS2hyYMHrj8YvvEJaI-_8NZd_GN_4iZ0,9972
24
24
  qbraid_cli/envs/create.py,sha256=xudzkLCNegY34zkXN_Vfl_0zVzg_tW83LcVx9quoWfU,988
25
25
  qbraid_cli/envs/data_handling.py,sha256=Ibnp2yJoUDpivb_sNqi0suYgJZNat_LmM6Ya0Ovez5s,1288
26
26
  qbraid_cli/files/__init__.py,sha256=3_yhgFoNcviEtS6B75uJBrfFFUjsrMcccCNEntJ54xU,175
@@ -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.3.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
38
- qbraid_cli-0.9.3.dist-info/METADATA,sha256=lL-5ZjFW1IHdCRUtXmJoAxxlsf8vNSoLboFmMAfwErc,6806
39
- qbraid_cli-0.9.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
40
- qbraid_cli-0.9.3.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
41
- qbraid_cli-0.9.3.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
42
- qbraid_cli-0.9.3.dist-info/RECORD,,
37
+ qbraid_cli-0.9.4.dist-info/LICENSE,sha256=P1gi-ofB8lmkRt_mxDoJpcgQq9Ckq9WhRAS1oYk-G1s,2506
38
+ qbraid_cli-0.9.4.dist-info/METADATA,sha256=fi9PnYYH7xpt09ko6-ejSpC_pdw4b6NsIj6LNcT8tEE,6806
39
+ qbraid_cli-0.9.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
40
+ qbraid_cli-0.9.4.dist-info/entry_points.txt,sha256=c5ZJ7NjbxhDqMpou9q5F03_b_KG34HzFDijIDmEIwgQ,47
41
+ qbraid_cli-0.9.4.dist-info/top_level.txt,sha256=LTYJgeYSCHo9Il8vZu0yIPuGdGyNaIw6iRy6BeoZo8o,11
42
+ qbraid_cli-0.9.4.dist-info/RECORD,,