qbraid-cli 0.8.0.dev3__tar.gz → 0.8.0.dev4__tar.gz

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.

Files changed (129) hide show
  1. {qbraid-cli-0.8.0.dev3/qbraid_cli.egg-info → qbraid_cli-0.8.dev4}/PKG-INFO +4 -2
  2. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/requirements.txt +1 -1
  3. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/pyproject.toml +3 -3
  4. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/_version.py +2 -2
  5. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/handlers.py +5 -1
  6. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/jobs/app.py +3 -4
  7. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/jobs/toggle_braket.py +27 -30
  8. qbraid_cli-0.8.dev4/qbraid_cli/jobs/validation.py +93 -0
  9. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4/qbraid_cli.egg-info}/PKG-INFO +4 -2
  10. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli.egg-info/requires.txt +3 -1
  11. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_app/test_jobs_disable.py +4 -2
  12. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_app/test_jobs_enable.py +5 -3
  13. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/test_disable_braket.py +5 -6
  14. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/test_enable_braket.py +9 -8
  15. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/test_get_package_data.py +48 -24
  16. qbraid_cli-0.8.dev4/tests/test_jobs/test_validation/test_get_state.py +62 -0
  17. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_validation/test_handle_jobs_state.py +7 -4
  18. qbraid-cli-0.8.0.dev3/qbraid_cli/jobs/validation.py +0 -74
  19. qbraid-cli-0.8.0.dev3/tests/test_jobs/test_validation/test_get_state.py +0 -46
  20. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.env.example +0 -0
  21. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  22. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  23. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  24. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/workflows/docs.yml +0 -0
  25. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/workflows/format.yml +0 -0
  26. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/workflows/main.yml +0 -0
  27. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/workflows/publish.yml +0 -0
  28. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.github/workflows/test-publish.yml +0 -0
  29. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.gitignore +0 -0
  30. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/.readthedocs.yml +0 -0
  31. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/CONTRIBUTING.md +0 -0
  32. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/MANIFEST.IN +0 -0
  33. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/Makefile +0 -0
  34. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/README.md +0 -0
  35. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/Makefile +0 -0
  36. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/api-key.png +0 -0
  37. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/cards/jupyter.png +0 -0
  38. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/cards/python.png +0 -0
  39. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/cards/terminal.png +0 -0
  40. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/favicon.ico +0 -0
  41. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/logo.png +0 -0
  42. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/style/custom.css +0 -0
  43. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/_static/style/s4defs-roles.css +0 -0
  44. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/configure.rst +0 -0
  45. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/credits.rst +0 -0
  46. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/devices-list.rst +0 -0
  47. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/devices.rst +0 -0
  48. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/envs-activate.rst +0 -0
  49. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/envs-list.rst +0 -0
  50. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/envs-uninstall.rst +0 -0
  51. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/envs.rst +0 -0
  52. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/jobs-add.rst +0 -0
  53. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/jobs-disable.rst +0 -0
  54. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/jobs-enable.rst +0 -0
  55. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/jobs-list.rst +0 -0
  56. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/jobs.rst +0 -0
  57. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/kernels.rst +0 -0
  58. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/cli/qbraid.rst +0 -0
  59. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/conf.py +0 -0
  60. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/guide/overview.rst +0 -0
  61. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/index.rst +0 -0
  62. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/docs/make.bat +0 -0
  63. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/__init__.py +0 -0
  64. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/configure/__init__.py +0 -0
  65. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/configure/actions.py +0 -0
  66. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/configure/app.py +0 -0
  67. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/credits/__init__.py +0 -0
  68. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/credits/app.py +0 -0
  69. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/devices/__init__.py +0 -0
  70. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/devices/app.py +0 -0
  71. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/devices/validation.py +0 -0
  72. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/envs/__init__.py +0 -0
  73. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/envs/activate.py +0 -0
  74. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/envs/app.py +0 -0
  75. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/envs/create.py +0 -0
  76. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/envs/data_handling.py +0 -0
  77. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/exceptions.py +0 -0
  78. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/jobs/__init__.py +0 -0
  79. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/kernels/__init__.py +0 -0
  80. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/kernels/app.py +0 -0
  81. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli/main.py +0 -0
  82. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli.egg-info/SOURCES.txt +0 -0
  83. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli.egg-info/dependency_links.txt +0 -0
  84. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli.egg-info/entry_points.txt +0 -0
  85. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/qbraid_cli.egg-info/top_level.txt +0 -0
  86. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/setup.cfg +0 -0
  87. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/__init__.py +0 -0
  88. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_configure/__init__.py +0 -0
  89. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_configure/test_configure_set.py +0 -0
  90. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_configure/test_prompt_for_config.py +0 -0
  91. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_configure/test_validate_input.py +0 -0
  92. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_credits/__init__.py +0 -0
  93. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_credits/test_credits_value.py +0 -0
  94. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_devices/__init__.py +0 -0
  95. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_devices/test_devices_list.py +0 -0
  96. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_devices/test_validations.py +0 -0
  97. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/__init__.py +0 -0
  98. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_activate/__init__.py +0 -0
  99. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_activate/test_activate_pyenv.py +0 -0
  100. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_activate/test_find_shell_rc.py +0 -0
  101. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_activate/test_print_activate_command.py +0 -0
  102. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_app/__init__.py +0 -0
  103. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_app/test_envs_activate.py +0 -0
  104. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_app/test_envs_create.py +0 -0
  105. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_app/test_envs_list.py +0 -0
  106. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_app/test_envs_remove.py +0 -0
  107. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_create/__init__.py +0 -0
  108. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_create/test_create_qbraid_env_assets.py +0 -0
  109. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_create/test_replace_str.py +0 -0
  110. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_create/test_update_state_json.py +0 -0
  111. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_data_handling/__init__.py +0 -0
  112. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_data_handling/test_installed_envs_data.py +0 -0
  113. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_data_handling/test_is_valid_env_name.py +0 -0
  114. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_data_handling/test_request_delete_env.py +0 -0
  115. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_envs/test_data_handling/test_validate_env_name.py +0 -0
  116. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/__init__.py +0 -0
  117. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_app/__init__.py +0 -0
  118. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_app/test_jobs_list.py +0 -0
  119. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_app/test_jobs_state.py +0 -0
  120. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/__init__.py +0 -0
  121. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/test_aws_configure_dummy.py +0 -0
  122. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_toggle_braket/test_confirm_updates.py +0 -0
  123. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_validation/__init__.py +0 -0
  124. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_validation/test_run_progress_get_state.py +0 -0
  125. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_jobs/test_validation/test_validate_library.py +0 -0
  126. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_kernels/__init__.py +0 -0
  127. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tests/test_kernels/test_kernels_list.py +0 -0
  128. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tools/split_rst.py +0 -0
  129. {qbraid-cli-0.8.0.dev3 → qbraid_cli-0.8.dev4}/tools/verify_headers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.8.0.dev3
3
+ Version: 0.8.0.dev4
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
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
29
29
  Requires-Dist: typer>=0.12.1
30
30
  Requires-Dist: rich>=10.11.0
31
31
  Requires-Dist: jupyter_client<9.0.0,>=7.0.0
32
- Requires-Dist: qbraid-core>=0.1.1
32
+ Requires-Dist: qbraid-core>=0.1.2
33
33
  Provides-Extra: jobs
34
34
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
35
  Provides-Extra: dev
@@ -43,6 +43,8 @@ Requires-Dist: sphinx-rtd-theme<2.1,>=1.3; extra == "docs"
43
43
  Requires-Dist: docutils<0.21; extra == "docs"
44
44
  Requires-Dist: toml; extra == "docs"
45
45
  Requires-Dist: build; extra == "docs"
46
+ Requires-Dist: m2r; extra == "docs"
47
+ Requires-Dist: typer; extra == "docs"
46
48
 
47
49
  <img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
48
50
 
@@ -1,7 +1,7 @@
1
1
  sphinx~=7.2.6
2
2
  sphinx-rtd-theme>=1.3,<2.1
3
3
  docutils<0.21
4
- typer-cli
4
+ typer
5
5
  m2r
6
6
  build
7
7
  toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qbraid-cli"
7
- version = "0.8.0.dev3"
7
+ version = "0.8.0.dev4"
8
8
  description = "Command Line Interface for interacting with all parts of the qBraid platform."
9
9
  readme = "README.md"
10
10
  authors = [{ name = "qBraid Development Team", email = "contact@qbraid.com" }]
@@ -30,7 +30,7 @@ dependencies = [
30
30
  "typer>=0.12.1",
31
31
  "rich>=10.11.0",
32
32
  "jupyter_client>=7.0.0,<9.0.0",
33
- "qbraid-core>=0.1.1",
33
+ "qbraid-core>=0.1.2",
34
34
  ]
35
35
  requires-python = ">= 3.9"
36
36
 
@@ -44,7 +44,7 @@ Discord = "https://discord.gg/KugF6Cnncm"
44
44
  [project.optional-dependencies]
45
45
  jobs = ["amazon-braket-sdk>=1.48.1"]
46
46
  dev = ["black", "isort", "pylint", "pytest"]
47
- docs = ["sphinx~=7.2.6", "sphinx-rtd-theme>=1.3,<2.1", "docutils<0.21", "toml", "build"]
47
+ docs = ["sphinx~=7.2.6", "sphinx-rtd-theme>=1.3,<2.1", "docutils<0.21", "toml", "build", "m2r", "typer"]
48
48
 
49
49
  [project.scripts]
50
50
  qbraid = "qbraid_cli.main:app"
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.dev1+g272a1c1'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev1', 'g272a1c1')
15
+ __version__ = version = '0.1.dev1+g9f219cc'
16
+ __version_tuple__ = version_tuple = (0, 1, 'dev1', 'g9f219cc')
@@ -44,7 +44,11 @@ def handle_error(
44
44
  full_message = f"\n{error_prefix} {message}\n"
45
45
  if include_traceback:
46
46
  tb_string = traceback.format_exc()
47
- full_message += f"\n{tb_string}"
47
+ # TODO: find out reason for weird traceback emitted from
48
+ # qbraid jobs enable/disable when library not installed.
49
+ # For now, if matches, just don't print it.
50
+ if tb_string.strip() != "NoneType: None":
51
+ full_message += f"\n{tb_string}"
48
52
  typer.echo(full_message, err=True)
49
53
  raise typer.Exit(code=1)
50
54
 
@@ -5,8 +5,6 @@
5
5
  Module defining commands in the 'qbraid jobs' namespace.
6
6
 
7
7
  """
8
-
9
- import sys
10
8
  from typing import Any, Callable, Dict, Tuple
11
9
 
12
10
  import typer
@@ -68,7 +66,8 @@ def jobs_state(
68
66
  )
69
67
  ) -> None:
70
68
  """Display the state of qBraid Quantum Jobs for the current environment."""
71
- state_values: Dict[str, Tuple[bool, bool]] = run_progress_get_state(library)
69
+ result: Tuple[str, Dict[str, Tuple[bool, bool]]] = run_progress_get_state(library)
70
+ python_exe, state_values = result
72
71
  state_values = dict(sorted(state_values.items()))
73
72
 
74
73
  console = Console()
@@ -76,7 +75,7 @@ def jobs_state(
76
75
  max_lib_length = max((len(lib) for lib in state_values.keys()), default=len(header_1))
77
76
  padding = max_lib_length + 9
78
77
 
79
- console.print(f"Executable: {sys.executable}")
78
+ console.print(f"Executable: {python_exe}")
80
79
  console.print(f"\n{header_1:<{padding}}{header_2}", style="bold")
81
80
 
82
81
  for lib, (installed, enabled) in state_values.items():
@@ -9,17 +9,10 @@ Module supporting 'qbraid jobs enable/disable braket' and commands.
9
9
  import logging
10
10
  import os
11
11
  import subprocess
12
- import sys
13
12
  from pathlib import Path
14
13
  from typing import Optional, Tuple
15
14
 
16
15
  import typer
17
- from qbraid_core.system import (
18
- QbraidSystemError,
19
- get_active_site_packages_path,
20
- get_latest_package_version,
21
- get_local_package_version,
22
- )
23
16
 
24
17
  from qbraid_cli.exceptions import QbraidException
25
18
  from qbraid_cli.handlers import handle_error, handle_filesystem_operation, run_progress_task
@@ -28,33 +21,38 @@ logging.basicConfig(level=logging.INFO)
28
21
  logger = logging.getLogger(__name__)
29
22
 
30
23
 
31
- def get_package_data(package: str) -> Tuple[str, str, str]:
24
+ def get_package_data(package: str) -> Tuple[str, str, str, str]:
32
25
  """Retrieve package version and location data.
33
26
 
34
27
  Args:
35
28
  package (str): The name of the package to retrieve data for.
36
29
 
37
30
  Returns:
38
- Tuple[str, str, str]: The installed and latest versions of the package, and the
39
- local site-packages path where it is / would be installed.
31
+ Tuple[str, str, str, str]: The installed and latest versions of the package, and the
32
+ local site-packages path where it is / would be installed.
40
33
 
41
34
  Raises:
42
35
  QbraidException: If package version or location data cannot be retrieved.
43
36
 
44
37
  """
38
+ # pylint: disable=import-outside-toplevel
39
+ from qbraid_core.system import (
40
+ QbraidSystemError,
41
+ get_active_python_path,
42
+ get_active_site_packages_path,
43
+ get_latest_package_version,
44
+ get_local_package_version,
45
+ )
45
46
 
46
47
  try:
47
- installed_version = get_local_package_version(package)
48
+ python_pathlib = get_active_python_path()
49
+ site_packages_path = get_active_site_packages_path(python_path=python_pathlib)
50
+ installed_version = get_local_package_version(package, python_path=python_pathlib)
48
51
  latest_version = get_latest_package_version(package)
49
52
  except QbraidSystemError as err:
50
- raise QbraidException("Failed to retrieve package version information") from err
51
-
52
- try:
53
- site_packages_path = get_active_site_packages_path()
54
- except QbraidSystemError as err:
55
- raise QbraidException("Failed to retrieve site-package location") from err
53
+ raise QbraidException("Failed to retrieve required system and/or package metadata") from err
56
54
 
57
- return installed_version, latest_version, site_packages_path
55
+ return installed_version, latest_version, str(site_packages_path), str(python_pathlib)
58
56
 
59
57
 
60
58
  def confirm_updates(
@@ -117,8 +115,6 @@ def confirm_updates(
117
115
  typer.echo("\nqBraidSystemExit: Exiting.")
118
116
  raise typer.Exit()
119
117
 
120
- typer.echo("")
121
-
122
118
 
123
119
  def aws_configure_dummy() -> None:
124
120
  """
@@ -156,23 +152,23 @@ def aws_configure_dummy() -> None:
156
152
 
157
153
  def enable_braket(auto_confirm: bool = False):
158
154
  """Enable qBraid quantum jobs for Amazon Braket."""
159
- installed, latest, path = run_progress_task(
155
+ installed, latest, path, python_exe = run_progress_task(
160
156
  get_package_data, "boto3", description="Solving environment..."
161
157
  )
162
158
 
163
159
  if not auto_confirm:
164
160
  confirm_updates("enable", path, installed_version=installed, latest_version=latest)
161
+ typer.echo("")
165
162
 
166
163
  aws_configure_dummy() # TODO: possibly add another confirmation for writing aws config files
164
+
167
165
  try:
168
- subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "boto3"])
166
+ subprocess.check_call([python_exe, "-m", "pip", "install", "--upgrade", "boto3"])
167
+ subprocess.check_call([python_exe, "-m", "pip", "uninstall", "botocore", "-y", "--quiet"])
169
168
  subprocess.check_call(
170
- [sys.executable, "-m", "pip", "uninstall", "botocore", "-y", "--quiet"]
169
+ [python_exe, "-m", "pip", "install", "git+https://github.com/qBraid/botocore.git"]
171
170
  )
172
- subprocess.check_call(
173
- [sys.executable, "-m", "pip", "install", "git+https://github.com/qBraid/botocore.git"]
174
- )
175
- except subprocess.CalledProcessError:
171
+ except (subprocess.CalledProcessError, FileNotFoundError):
176
172
  handle_error(message="Failed to enable qBraid quantum jobs.")
177
173
 
178
174
  typer.secho("\nSuccessfully enabled qBraid quantum jobs.", fg=typer.colors.GREEN, bold=True)
@@ -182,18 +178,19 @@ def enable_braket(auto_confirm: bool = False):
182
178
  def disable_braket(auto_confirm: bool = False):
183
179
  """Disable qBraid quantum jobs for Amazon Braket."""
184
180
  package = "botocore"
185
- installed, latest, path = run_progress_task(
181
+ installed, latest, path, python_exe = run_progress_task(
186
182
  get_package_data, package, description="Solving environment..."
187
183
  )
188
184
  package = f"{package}~={installed}" if installed < latest else package
189
185
 
190
186
  if not auto_confirm:
191
187
  confirm_updates("disable", path)
188
+ typer.echo("")
192
189
 
193
190
  try:
194
191
  subprocess.check_call(
195
192
  [
196
- sys.executable,
193
+ python_exe,
197
194
  "-m",
198
195
  "pip",
199
196
  "install",
@@ -202,7 +199,7 @@ def disable_braket(auto_confirm: bool = False):
202
199
  ],
203
200
  stderr=subprocess.DEVNULL,
204
201
  )
205
- except subprocess.CalledProcessError:
202
+ except (subprocess.CalledProcessError, FileNotFoundError):
206
203
  handle_error(message="Failed to disable qBraid quantum jobs.")
207
204
 
208
205
  typer.secho("\nSuccessfully disabled qBraid quantum jobs.", fg=typer.colors.GREEN, bold=True)
@@ -0,0 +1,93 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module for validating command arguments for qBraid Quantum Jobs.
6
+
7
+ """
8
+ import sys
9
+ from typing import Any, Callable, Dict, Optional, Tuple
10
+
11
+ import typer
12
+ from rich.console import Console
13
+
14
+ from qbraid_cli.handlers import handle_error, run_progress_task, validate_item
15
+
16
+ LEGACY_ARGS: Dict[str, str] = {
17
+ "amazon_braket": "braket",
18
+ "aws_braket": "braket",
19
+ }
20
+
21
+
22
+ def validate_library(value: str) -> str:
23
+ """Validate quantum jobs library."""
24
+ # pylint:disable-next=import-outside-toplevel
25
+ from qbraid_core.services.quantum.proxy import SUPPORTED_QJOB_LIBS
26
+
27
+ qjobs_libs = list(SUPPORTED_QJOB_LIBS.keys())
28
+
29
+ if value in LEGACY_ARGS:
30
+ old_value = value
31
+ value = LEGACY_ARGS[value]
32
+
33
+ console = Console()
34
+ console.print(
35
+ f"[red]DeprecationWarning:[/red] Argument '{old_value}' "
36
+ f"is deprecated. Use '{value}' instead.\n"
37
+ )
38
+
39
+ return validate_item(value, qjobs_libs, "Library")
40
+
41
+
42
+ def get_state(library: Optional[str] = None) -> Tuple[str, Dict[str, Tuple[bool, bool]]]:
43
+ """Get the state of qBraid Quantum Jobs for the specified library."""
44
+ from qbraid_core.services.quantum import QuantumClient
45
+
46
+ jobs_state = QuantumClient.qbraid_jobs_state(device_lib=library)
47
+
48
+ python_exe: str = jobs_state.get("exe", sys.executable)
49
+ libs_state: Dict[str, Any] = jobs_state.get("libs", {})
50
+
51
+ state_values = {
52
+ lib: (state["supported"], state["enabled"]) for lib, state in libs_state.items()
53
+ }
54
+
55
+ return python_exe, state_values
56
+
57
+
58
+ def run_progress_get_state(
59
+ library: Optional[str] = None,
60
+ ) -> Tuple[str, Dict[str, Tuple[bool, bool]]]:
61
+ """Run get state function with rich progress UI."""
62
+ return run_progress_task(
63
+ get_state,
64
+ library,
65
+ description="Collecting package metadata...",
66
+ error_message=f"Failed to collect {library} package metadata.",
67
+ )
68
+
69
+
70
+ def handle_jobs_state(
71
+ library: str,
72
+ action: str, # 'enable' or 'disable'
73
+ action_callback: Callable[[], None],
74
+ ) -> None:
75
+ """Handle the common logic for enabling or disabling qBraid Quantum Jobs."""
76
+ _, state_values = run_progress_get_state(library)
77
+ installed, enabled = state_values[library]
78
+
79
+ if not installed:
80
+ handle_error(
81
+ message=f"{library} not installed."
82
+ ) # TODO: Provide command to install library?
83
+ if (enabled and action == "enable") or (not enabled and action == "disable"):
84
+ action_color = "green" if enabled else "red"
85
+ console = Console()
86
+ console.print(
87
+ f"\nqBraid quantum jobs already [bold {action_color}]{action}d[/bold {action_color}] "
88
+ f"for [magenta]{library}[/magenta].\n\nCheck the state of all quantum jobs "
89
+ "libraries in this environment with: \n\n\t$ qbraid jobs state\n"
90
+ )
91
+ raise typer.Exit()
92
+
93
+ action_callback() # Perform the specific enable/disable action
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.8.0.dev3
3
+ Version: 0.8.0.dev4
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
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
29
29
  Requires-Dist: typer>=0.12.1
30
30
  Requires-Dist: rich>=10.11.0
31
31
  Requires-Dist: jupyter_client<9.0.0,>=7.0.0
32
- Requires-Dist: qbraid-core>=0.1.1
32
+ Requires-Dist: qbraid-core>=0.1.2
33
33
  Provides-Extra: jobs
34
34
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
35
  Provides-Extra: dev
@@ -43,6 +43,8 @@ Requires-Dist: sphinx-rtd-theme<2.1,>=1.3; extra == "docs"
43
43
  Requires-Dist: docutils<0.21; extra == "docs"
44
44
  Requires-Dist: toml; extra == "docs"
45
45
  Requires-Dist: build; extra == "docs"
46
+ Requires-Dist: m2r; extra == "docs"
47
+ Requires-Dist: typer; extra == "docs"
46
48
 
47
49
  <img width="full" alt="qbraid_cli" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid-cli-banner.png">
48
50
 
@@ -1,7 +1,7 @@
1
1
  typer>=0.12.1
2
2
  rich>=10.11.0
3
3
  jupyter_client<9.0.0,>=7.0.0
4
- qbraid-core>=0.1.1
4
+ qbraid-core>=0.1.2
5
5
 
6
6
  [dev]
7
7
  black
@@ -15,6 +15,8 @@ sphinx-rtd-theme<2.1,>=1.3
15
15
  docutils<0.21
16
16
  toml
17
17
  build
18
+ m2r
19
+ typer
18
20
 
19
21
  [jobs]
20
22
  amazon-braket-sdk>=1.48.1
@@ -14,8 +14,10 @@ from qbraid_core.services.quantum.proxy import SUPPORTED_QJOB_LIBS
14
14
 
15
15
  from qbraid_cli.jobs.app import jobs_disable
16
16
 
17
+ qjob_libs = list(SUPPORTED_QJOB_LIBS.keys())
17
18
 
18
- @pytest.mark.parametrize("library", SUPPORTED_QJOB_LIBS)
19
+
20
+ @pytest.mark.parametrize("library", qjob_libs)
19
21
  def test_library_validation_on_disable(library):
20
22
  """Test library validation function during the jobs disable command."""
21
23
  with (
@@ -35,7 +37,7 @@ def test_error_for_unsupported_library_on_disable():
35
37
  jobs_disable(library="unsupported_library")
36
38
 
37
39
 
38
- @pytest.mark.parametrize("library", SUPPORTED_QJOB_LIBS)
40
+ @pytest.mark.parametrize("library", qjob_libs)
39
41
  def test_handle_jobs_state_integration_on_disable(library):
40
42
  """Test the handle_jobs_state function during the jobs disable command."""
41
43
  with (
@@ -15,8 +15,10 @@ from qbraid_core.services.quantum.proxy import SUPPORTED_QJOB_LIBS
15
15
 
16
16
  from qbraid_cli.jobs.app import jobs_enable
17
17
 
18
+ qjobs_libs = list(SUPPORTED_QJOB_LIBS.keys())
18
19
 
19
- @pytest.mark.parametrize("library", SUPPORTED_QJOB_LIBS)
20
+
21
+ @pytest.mark.parametrize("library", qjobs_libs)
20
22
  def test_library_validation(library):
21
23
  """Test library validation function during the jobs enable command."""
22
24
  with (
@@ -31,7 +33,7 @@ def test_library_validation(library):
31
33
  mock_validate_library.assert_called_once_with(library)
32
34
 
33
35
 
34
- @pytest.mark.parametrize("library", SUPPORTED_QJOB_LIBS)
36
+ @pytest.mark.parametrize("library", qjobs_libs)
35
37
  def test_enable_action_for_supported_library(library):
36
38
  """Test the enable action for supported libraries."""
37
39
  if importlib.util.find_spec(library) is None:
@@ -50,7 +52,7 @@ def test_raise_error_for_unsupported_library():
50
52
  jobs_enable(library="unsupported_library")
51
53
 
52
54
 
53
- @pytest.mark.parametrize("library", SUPPORTED_QJOB_LIBS)
55
+ @pytest.mark.parametrize("library", qjobs_libs)
54
56
  def test_handle_jobs_state_integration(library):
55
57
  """Test the handle_jobs_state function during the jobs enable command."""
56
58
  with (
@@ -7,7 +7,6 @@ Unit tests for the disable_braket function in the toggle_braket module.
7
7
  """
8
8
 
9
9
  import subprocess
10
- import sys
11
10
  from unittest.mock import patch
12
11
 
13
12
  import pytest
@@ -24,7 +23,7 @@ def test_helper_functions_invoked_correctly():
24
23
  with (
25
24
  patch(
26
25
  "qbraid_cli.jobs.toggle_braket.get_package_data",
27
- return_value=("1.0.0", "1.1.0", "/some/path"),
26
+ return_value=("1.0.0", "1.1.0", "/some/path", "/usr/bin/python"),
28
27
  ) as mock_get_package_data_disable,
29
28
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates") as mock_confirm_updates,
30
29
  ):
@@ -44,7 +43,7 @@ def test_package_version_specification_for_reinstallation():
44
43
  with (
45
44
  patch(
46
45
  "qbraid_cli.jobs.toggle_braket.get_package_data",
47
- return_value=("1.0.0", "1.1.0", "/some/path"),
46
+ return_value=("1.0.0", "1.1.0", "/some/path", "/usr/bin/python"),
48
47
  ),
49
48
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
50
49
  patch("subprocess.check_call") as mock_check_call,
@@ -53,7 +52,7 @@ def test_package_version_specification_for_reinstallation():
53
52
 
54
53
  mock_check_call.assert_called_with(
55
54
  [
56
- sys.executable,
55
+ "/usr/bin/python",
57
56
  "-m",
58
57
  "pip",
59
58
  "install",
@@ -72,7 +71,7 @@ def test_subprocess_execution_and_error_handling():
72
71
  with (
73
72
  patch(
74
73
  "qbraid_cli.jobs.toggle_braket.get_package_data",
75
- return_value=("1.0.0", "1.0.0", "/some/path"),
74
+ return_value=("1.0.0", "1.0.0", "/some/path", "/usr/bin/python"),
76
75
  ),
77
76
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
78
77
  patch("subprocess.check_call", side_effect=subprocess.CalledProcessError(1, "cmd")),
@@ -87,7 +86,7 @@ def test_success_message_displayed():
87
86
  with (
88
87
  patch(
89
88
  "qbraid_cli.jobs.toggle_braket.get_package_data",
90
- return_value=("1.0.0", "1.0.0", "/some/path"),
89
+ return_value=("1.0.0", "1.0.0", "/some/path", "/usr/bin/python"),
91
90
  ),
92
91
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
93
92
  patch("subprocess.check_call"),
@@ -7,7 +7,6 @@ Unit tests for the enable_braket function in the toggle_braket module.
7
7
  """
8
8
 
9
9
  import subprocess
10
- import sys
11
10
  from unittest.mock import call, patch
12
11
 
13
12
  import pytest
@@ -21,7 +20,7 @@ def test_helper_function_invocations():
21
20
  with (
22
21
  patch(
23
22
  "qbraid_cli.jobs.toggle_braket.get_package_data",
24
- return_value=("1.0.0", "1.2.0", "/some/path"),
23
+ return_value=("1.0.0", "1.2.0", "/some/path", "/usr/bin/python"),
25
24
  ) as mock_get_package_data,
26
25
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates") as mock_confirm_updates,
27
26
  patch("qbraid_cli.jobs.toggle_braket.aws_configure_dummy") as mock_aws_configure_dummy,
@@ -36,10 +35,12 @@ def test_helper_function_invocations():
36
35
 
37
36
  def test_subprocess_calls():
38
37
  """Test the subprocess calls within `enable_braket`."""
38
+ mock_python_path = "/usr/bin/python"
39
+
39
40
  with (
40
41
  patch(
41
42
  "qbraid_cli.jobs.toggle_braket.get_package_data",
42
- return_value=("1.0.0", "1.2.0", "/some/path"),
43
+ return_value=("1.0.0", "1.2.0", "/some/path", mock_python_path),
43
44
  ),
44
45
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
45
46
  patch("qbraid_cli.jobs.toggle_braket.aws_configure_dummy"),
@@ -49,11 +50,11 @@ def test_subprocess_calls():
49
50
 
50
51
  # Expected subprocess calls in order
51
52
  expected_calls = [
52
- call([sys.executable, "-m", "pip", "install", "--upgrade", "boto3"]),
53
- call([sys.executable, "-m", "pip", "uninstall", "botocore", "-y", "--quiet"]),
53
+ call([mock_python_path, "-m", "pip", "install", "--upgrade", "boto3"]),
54
+ call([mock_python_path, "-m", "pip", "uninstall", "botocore", "-y", "--quiet"]),
54
55
  call(
55
56
  [
56
- sys.executable,
57
+ mock_python_path,
57
58
  "-m",
58
59
  "pip",
59
60
  "install",
@@ -69,7 +70,7 @@ def test_subprocess_error_handling():
69
70
  with (
70
71
  patch(
71
72
  "qbraid_cli.jobs.toggle_braket.get_package_data",
72
- return_value=("1.0.0", "1.2.0", "/some/path"),
73
+ return_value=("1.0.0", "1.2.0", "/some/path", "/usr/bin/python"),
73
74
  ),
74
75
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
75
76
  patch("qbraid_cli.jobs.toggle_braket.aws_configure_dummy"),
@@ -87,7 +88,7 @@ def test_success_feedback():
87
88
  with (
88
89
  patch(
89
90
  "qbraid_cli.jobs.toggle_braket.get_package_data",
90
- return_value=("1.0.0", "1.2.0", "/some/path"),
91
+ return_value=("1.0.0", "1.2.0", "/some/path", "/usr/bin/python"),
91
92
  ),
92
93
  patch("qbraid_cli.jobs.toggle_braket.confirm_updates"),
93
94
  patch("qbraid_cli.jobs.toggle_braket.aws_configure_dummy"),