qbraid-cli 0.9.0a0__tar.gz → 0.9.1__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 (110) hide show
  1. qbraid_cli-0.9.1/.github/workflows/docs-pr.yml +128 -0
  2. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.readthedocs.yml +1 -1
  3. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/CONTRIBUTING.md +6 -0
  4. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/PKG-INFO +2 -2
  5. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/index.rst +2 -1
  6. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/pyproject.toml +2 -2
  7. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/_version.py +2 -2
  8. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/account/app.py +1 -1
  9. qbraid_cli-0.9.1/qbraid_cli/chat/__init__.py +11 -0
  10. qbraid_cli-0.9.1/qbraid_cli/chat/app.py +96 -0
  11. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/devices/app.py +1 -1
  12. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/envs/app.py +3 -3
  13. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/handlers.py +19 -5
  14. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/jobs/app.py +1 -1
  15. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/jobs/toggle_braket.py +1 -1
  16. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/main.py +4 -1
  17. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/PKG-INFO +2 -2
  18. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/SOURCES.txt +4 -0
  19. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/requires.txt +1 -1
  20. qbraid_cli-0.9.1/tests/conftest.py +35 -0
  21. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/devices/test_devices_list.py +4 -16
  22. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_list.py +3 -13
  23. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.env.example +0 -0
  24. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  25. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  26. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  27. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/bump-version.yml +0 -0
  28. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/docs.yml +0 -0
  29. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/format.yml +0 -0
  30. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/main.yml +0 -0
  31. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/pre-release.yml +0 -0
  32. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/publish.yml +0 -0
  33. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.github/workflows/tag-on-merge.yml +0 -0
  34. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/.gitignore +0 -0
  35. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/LICENSE +0 -0
  36. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/MANIFEST.IN +0 -0
  37. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/Makefile +0 -0
  38. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/README.md +0 -0
  39. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/Makefile +0 -0
  40. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/_static/favicon.ico +0 -0
  41. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/_static/logo.png +0 -0
  42. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/_static/style/custom.css +0 -0
  43. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/_static/style/s4defs-roles.css +0 -0
  44. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/conf.py +0 -0
  45. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/make.bat +0 -0
  46. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/docs/requirements.txt +0 -0
  47. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/__init__.py +0 -0
  48. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/account/__init__.py +0 -0
  49. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/admin/__init__.py +0 -0
  50. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/admin/app.py +0 -0
  51. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/admin/headers.py +0 -0
  52. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/admin/validation.py +0 -0
  53. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/configure/__init__.py +0 -0
  54. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/configure/actions.py +0 -0
  55. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/configure/app.py +0 -0
  56. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/devices/__init__.py +0 -0
  57. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/devices/validation.py +0 -0
  58. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/envs/__init__.py +0 -0
  59. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/envs/activate.py +0 -0
  60. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/envs/create.py +0 -0
  61. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/envs/data_handling.py +0 -0
  62. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/exceptions.py +0 -0
  63. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/jobs/__init__.py +0 -0
  64. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/jobs/validation.py +0 -0
  65. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/kernels/__init__.py +0 -0
  66. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/kernels/app.py +0 -0
  67. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/pip/__init__.py +0 -0
  68. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/pip/app.py +0 -0
  69. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/pip/hooks.py +0 -0
  70. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli/py.typed +0 -0
  71. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/dependency_links.txt +0 -0
  72. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/entry_points.txt +0 -0
  73. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/qbraid_cli.egg-info/top_level.txt +0 -0
  74. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/setup.cfg +0 -0
  75. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/__init__.py +0 -0
  76. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/account/__init__.py +0 -0
  77. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/account/test_account_credits.py +0 -0
  78. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/admin/test_headers.py +0 -0
  79. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/configure/__init__.py +0 -0
  80. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/configure/test_configure_prompt_for_config.py +0 -0
  81. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/configure/test_configure_set.py +0 -0
  82. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/configure/test_configure_validate_input.py +0 -0
  83. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/devices/__init__.py +0 -0
  84. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/devices/test_devices_validations.py +0 -0
  85. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/__init__.py +0 -0
  86. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_activate.py +0 -0
  87. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_activate_find_shell_rc.py +0 -0
  88. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_activate_print_command.py +0 -0
  89. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_activate_pyenv.py +0 -0
  90. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_list.py +0 -0
  91. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/envs/test_envs_remove.py +0 -0
  92. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/__init__.py +0 -0
  93. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_disable.py +0 -0
  94. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_enable.py +0 -0
  95. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_state.py +0 -0
  96. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_toggle_braket_confirm.py +0 -0
  97. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_toggle_braket_disable.py +0 -0
  98. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_toggle_braket_enable.py +0 -0
  99. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_toggle_braket_get_data.py +0 -0
  100. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_validate_get_state.py +0 -0
  101. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_validate_handle_state.py +0 -0
  102. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/jobs/test_jobs_validate_library.py +0 -0
  103. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/kernels/__init__.py +0 -0
  104. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tests/kernels/test_kernels_list.py +0 -0
  105. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/bump_version.py +0 -0
  106. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/create_dev_build.sh +0 -0
  107. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/install_wheel_extras.sh +0 -0
  108. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/split_md.py +0 -0
  109. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/split_rst.py +0 -0
  110. {qbraid_cli-0.9.0a0 → qbraid_cli-0.9.1}/tools/stamp_pre_release.py +0 -0
@@ -0,0 +1,128 @@
1
+ name: Open Docs PR
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+
7
+ jobs:
8
+ generate-docs-assets:
9
+ if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'github-actions[bot]' && startsWith(github.event.pull_request.title, 'Bump project version to ')
10
+ runs-on: ubuntu-latest
11
+ outputs:
12
+ cli_version: ${{ steps.get_version.outputs.version }}
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+ with:
17
+ ref: main
18
+
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip setuptools build
22
+ python -m pip install -r docs/requirements.txt
23
+
24
+ - name: Build & install package
25
+ run: |
26
+ make build
27
+ tools/install_wheel_extras.sh dist --extra envs
28
+
29
+ - name: Get qbraid-cli version
30
+ id: get_version
31
+ run: |
32
+ VERSION=$(qbraid --version | grep -o '[0-9]*\.[0-9]*\.[0-9]*')
33
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
34
+
35
+ - name: Generate docs assets
36
+ run: |
37
+ make docs-mdx
38
+
39
+ - name: Upload docs assets
40
+ uses: actions/upload-artifact@v4
41
+ with:
42
+ name: api-reference
43
+ path: docs/tree/qbraid*.mdx
44
+
45
+ commit-and-pr:
46
+ if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'github-actions[bot]' && startsWith(github.event.pull_request.title, 'Bump project version to ')
47
+ runs-on: ubuntu-latest
48
+ needs: generate-docs-assets
49
+ permissions:
50
+ contents: write
51
+ pull-requests: write
52
+
53
+ steps:
54
+ - name: Download docs assets
55
+ uses: actions/download-artifact@v4
56
+ with:
57
+ name: api-reference
58
+ path: ./api-reference
59
+
60
+ - name: Checkout qBraid/docs repo
61
+ uses: actions/checkout@v4
62
+ with:
63
+ repository: qBraid/docs
64
+ token: ${{ secrets.BOT_TOKEN }}
65
+ path: ./qbraid_docs
66
+ ref: main
67
+
68
+ - name: Create feature branch
69
+ run: |
70
+ cd qbraid_docs
71
+ git checkout -b qbraid-cli-bot/${{ github.run_id }}
72
+
73
+ - name: Update docs in qBraid/docs
74
+ run: |
75
+ rm -f qbraid_docs/cli/api-reference/*
76
+ cp api-reference/qbraid*.mdx qbraid_docs/cli/api-reference/
77
+
78
+ - name: Inject version
79
+ run: |
80
+ VERSION=${{ needs.generate-docs-assets.outputs.cli_version }}
81
+ sed -i "6iVersion: [$VERSION](https://pypi.org/project/qbraid-cli/$VERSION)\n" qbraid_docs/cli/api-reference/qbraid.mdx
82
+
83
+ - name: Set up Node.js
84
+ uses: actions/setup-node@v4
85
+ with:
86
+ node-version: '22'
87
+
88
+ - name: Install dependencies
89
+ run: |
90
+ cd qbraid_docs
91
+ npm install
92
+
93
+ - name: Run prettier fixes
94
+ run: |
95
+ cd qbraid_docs
96
+ npx prettier --write cli/api-reference/qbraid*.mdx
97
+
98
+ - name: Setup Git config
99
+ run: |
100
+ git config --global user.name 'qbraidTeam'
101
+ git config --global user.email 'qbraid.team@qbraid.com'
102
+
103
+ - name: Commit and push changes
104
+ id: commit_and_push
105
+ run: |
106
+ cd qbraid_docs
107
+ git add cli/api-reference/
108
+ git commit -m "qBraid-CLI API reference docs update for version $VERSION"
109
+ git push origin qbraid-cli-bot/${{ github.run_id }}
110
+
111
+ - name: Create Pull Request
112
+ id: create_pr
113
+ run: |
114
+ cd qbraid_docs
115
+ VERSION=${{ needs.generate-docs-assets.outputs.cli_version }}
116
+ PR_URL=$(gh pr create -B main -H qbraid-cli-bot/${{ github.run_id }} --title "Update qBraid-CLI version $VERSION" --body "This PR updates the qBraid-CLI API reference docs for the latest release version $VERSION")
117
+ PR_NUMBER=$(echo "$PR_URL" | grep -o '[0-9]*$')
118
+ echo "url=$PR_URL" >> $GITHUB_OUTPUT
119
+ echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
120
+ env:
121
+ GH_TOKEN: ${{ secrets.BOT_TOKEN }}
122
+
123
+ - name: Summary
124
+ run: |
125
+ VERSION=${{ needs.generate-docs-assets.outputs.cli_version }}
126
+ PR_URL=${{ steps.create_pr.outputs.url }}
127
+ PR_NUMBER=${{ steps.create_pr.outputs.number }}
128
+ echo "Opened PR [#$PR_NUMBER]($PR_URL) to update CLI docs for version **$VERSION**." >> $GITHUB_STEP_SUMMARY
@@ -13,7 +13,7 @@ build:
13
13
  - python -m pip install -r docs/requirements.txt
14
14
  - python -m pip install build
15
15
  - python -m build .
16
- - python -m pip install dist/*.whl
16
+ - tools/install_wheel_extras.sh dist --extra envs
17
17
  - mkdir -p docs/tree
18
18
  - rm -f docs/tree/*.rst
19
19
  - typer qbraid_cli.main utils docs --name=qbraid --output=docs/tree/qbraid.md
@@ -39,6 +39,12 @@ To view available `make` commands, run:
39
39
  make help
40
40
  ```
41
41
 
42
+ To test out changes on the command line with re-installing each time:
43
+
44
+ ```bash
45
+ python3 qbraid_cli/main.py [OPTIONS] COMMAND [ARGS]...
46
+ ```
47
+
42
48
  ## Testing
43
49
 
44
50
  Install test dependencies:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.9.0a0
3
+ Version: 0.9.1
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
  License-File: LICENSE
30
30
  Requires-Dist: typer>=0.12.1
31
31
  Requires-Dist: rich>=10.11.0
32
- Requires-Dist: qbraid-core>=0.1.28
32
+ Requires-Dist: qbraid-core>=0.1.30
33
33
  Provides-Extra: jobs
34
34
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
35
  Provides-Extra: envs
@@ -120,4 +120,5 @@ by disabling quantum jobs:
120
120
  tree/qbraid_envs
121
121
  tree/qbraid_jobs
122
122
  tree/qbraid_kernels
123
- tree/qbraid_pip
123
+ tree/qbraid_pip
124
+ tree/qbraid_chat
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qbraid-cli"
7
- version = "0.9.0a0"
7
+ version = "0.9.1"
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 @@ classifiers = [
30
30
  dependencies = [
31
31
  "typer>=0.12.1",
32
32
  "rich>=10.11.0",
33
- "qbraid-core>=0.1.28",
33
+ "qbraid-core>=0.1.30",
34
34
  ]
35
35
  requires-python = ">= 3.9"
36
36
 
@@ -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+ge41229b.d20241106'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev1', 'ge41229b.d20241106')
15
+ __version__ = version = '0.1.dev1+gbfaed43'
16
+ __version_tuple__ = version_tuple = (0, 1, 'dev1', 'gbfaed43')
@@ -28,7 +28,7 @@ def account_credits():
28
28
 
29
29
  qbraid_credits: float = run_progress_task(get_credits)
30
30
  typer.secho(
31
- f"\n{typer.style('qBraid credits remaining:')} "
31
+ f"{typer.style('qBraid credits remaining:')} "
32
32
  f"{typer.style(f'{qbraid_credits:.4f}', fg=typer.colors.MAGENTA, bold=True)}",
33
33
  nl=True, # Ensure a newline after output (default is True)
34
34
  )
@@ -0,0 +1,11 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining the qbraid chat namespace
6
+
7
+ """
8
+
9
+ from .app import chat_app
10
+
11
+ __all__ = ["chat_app"]
@@ -0,0 +1,96 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining commands in the 'qbraid chat' namespace.
6
+
7
+ """
8
+ from enum import Enum
9
+
10
+ import typer
11
+ from rich.console import Console
12
+ from rich.table import Table
13
+
14
+ from qbraid_cli.handlers import handle_error, run_progress_task
15
+
16
+ chat_app = typer.Typer(
17
+ help="Interact with qBraid AI chat service.", pretty_exceptions_show_locals=False
18
+ )
19
+
20
+
21
+ class ChatFormat(str, Enum):
22
+ """Format of the response from the chat service."""
23
+
24
+ text = "text" # pylint: disable=invalid-name
25
+ code = "code" # pylint: disable=invalid-name
26
+
27
+
28
+ @chat_app.command("send")
29
+ def chat_send(
30
+ prompt: str = typer.Argument(..., help="The prompt to send to the chat service."),
31
+ model: str = typer.Option(None, "--model", "-m", help="The model to use for the chat service."),
32
+ response_format: ChatFormat = typer.Option(
33
+ ChatFormat.text, "--format", "-f", help="The format of the response."
34
+ ),
35
+ stream: bool = typer.Option(False, "--stream", "-s", help="Stream the response."),
36
+ ):
37
+ """
38
+ Interact with qBraid AI chat service.
39
+
40
+ """
41
+ # pylint: disable-next=import-outside-toplevel
42
+ from qbraid_core.services.chat import ChatClient, ChatServiceRequestError
43
+
44
+ client = ChatClient()
45
+
46
+ if response_format == ChatFormat.code:
47
+ prompt += " Return only raw code. Do not include any text outside of code blocks."
48
+
49
+ if stream:
50
+ try:
51
+ for chunk in client.chat_stream(prompt, model, response_format):
52
+ print(chunk, end="")
53
+ except ChatServiceRequestError as err:
54
+ handle_error(message=str(err), include_traceback=False)
55
+ else:
56
+ content = run_progress_task(
57
+ client.chat,
58
+ prompt,
59
+ model,
60
+ response_format,
61
+ description="Connecting to chat service...",
62
+ include_error_traceback=False,
63
+ )
64
+ print(content)
65
+
66
+
67
+ @chat_app.command(name="models")
68
+ def chat_models():
69
+ """List available chat models."""
70
+ # pylint: disable-next=import-outside-toplevel
71
+ from qbraid_core.services.chat import ChatClient
72
+
73
+ client = ChatClient()
74
+
75
+ models = run_progress_task(
76
+ client.get_models,
77
+ description="Connecting to chat service...",
78
+ include_error_traceback=False,
79
+ )
80
+
81
+ console = Console()
82
+ table = Table(title="Available Chat Models\n", show_lines=True, title_justify="left")
83
+
84
+ table.add_column("Model", style="cyan", no_wrap=True)
85
+ table.add_column("Pricing [not bold](1k tokens ~750 words)", style="magenta")
86
+ table.add_column("Description", style="green")
87
+
88
+ for model in models:
89
+ table.add_row(
90
+ model["model"],
91
+ f"{model['pricing']['input']} credits / 1M input tokens\n"
92
+ f"{model['pricing']['output']} credits / 1M output tokens",
93
+ model["description"],
94
+ )
95
+
96
+ console.print(table)
@@ -60,7 +60,7 @@ def devices_list( # pylint: disable=too-many-branches
60
60
  header_3 = "ID"
61
61
  header_4 = "Status"
62
62
  console.print(
63
- f"\n[bold]{header_1.ljust(12)}{header_2.ljust(35)}{header_3.ljust(41)}{header_4}[/bold]"
63
+ f"[bold]{header_1.ljust(12)}{header_2.ljust(35)}{header_3.ljust(41)}{header_4}[/bold]"
64
64
  )
65
65
  for device_provider, device_name, device_id, device_status in device_data:
66
66
  if device_status == "ONLINE":
@@ -88,7 +88,7 @@ def envs_create( # pylint: disable=too-many-statements
88
88
  slug_path = env_path / slug
89
89
  description = "None" if description == "" else description
90
90
 
91
- typer.echo("\n\n## qBraid Metadata ##\n")
91
+ typer.echo("## qBraid Metadata ##\n")
92
92
  typer.echo(f" name: {display_name}")
93
93
  typer.echo(f" description: {description}")
94
94
  typer.echo(f" tags: {tags}")
@@ -127,7 +127,7 @@ def envs_create( # pylint: disable=too-many-statements
127
127
 
128
128
  console = Console()
129
129
  console.print(
130
- f"\n[bold green]Successfully created qBraid environment: "
130
+ f"[bold green]Successfully created qBraid environment: "
131
131
  f"[/bold green][bold magenta]{name}[/bold magenta]\n"
132
132
  )
133
133
  typer.echo("# To activate this environment, use")
@@ -192,7 +192,7 @@ def envs_remove(
192
192
  description="Deleting local environment...",
193
193
  error_message="Failed to delete qBraid environment",
194
194
  )
195
- typer.echo(f"\nEnvironment '{name}' successfully removed.")
195
+ typer.echo(f"Environment '{name}' successfully removed.")
196
196
 
197
197
 
198
198
  @envs_app.command(name="list")
@@ -10,11 +10,12 @@ and executing operations with progress tracking within the qBraid CLI.
10
10
  import os
11
11
  import traceback
12
12
  from pathlib import Path
13
+ from time import sleep
13
14
  from typing import Any, Callable, Optional, Union
14
15
 
15
16
  import typer
16
17
  from rich.console import Console
17
- from rich.progress import Progress, SpinnerColumn, TextColumn
18
+ from rich.progress import Progress, SpinnerColumn, TaskID, TextColumn
18
19
 
19
20
  from .exceptions import DEFAULT_ERROR_MESSAGE, QbraidException
20
21
 
@@ -24,6 +25,14 @@ def _should_display_progress():
24
25
  return os.getenv("QBRAID_CLI_SHOW_PROGRESS", "true").lower() in ["true", "1", "t", "y", "yes"]
25
26
 
26
27
 
28
+ def _update_completed_task(
29
+ progress: Progress, task_id: TaskID, success: bool = True, sleep_time: float = 0.15
30
+ ):
31
+ status = "Done" if success else "Failed"
32
+ progress.update(task_id, completed=100, status=status)
33
+ sleep(sleep_time)
34
+
35
+
27
36
  def handle_error(
28
37
  error_type: Optional[str] = None, message: Optional[str] = None, include_traceback: bool = True
29
38
  ) -> None:
@@ -85,6 +94,7 @@ def run_progress_task(
85
94
  *args,
86
95
  description: Optional[str] = None,
87
96
  error_message: Optional[str] = None,
97
+ include_error_traceback: bool = True,
88
98
  **kwargs,
89
99
  ) -> Any:
90
100
  """
@@ -102,6 +112,8 @@ def run_progress_task(
102
112
  error_message (optional, str): Custom error message to display if the operation.
103
113
  fails. Defaults to None, in which case the
104
114
  exception's message is used.
115
+ include_error_traceback (bool): Whether to include the traceback in the error message.
116
+ Defaults to True.
105
117
  **kwargs: Arbitrary keyword arguments for the operation.
106
118
 
107
119
  Returns:
@@ -115,7 +127,7 @@ def run_progress_task(
115
127
  return operation(*args, **kwargs)
116
128
  except Exception as err: # pylint: disable=broad-exception-caught
117
129
  custom_message = error_message if error_message else str(err)
118
- return handle_error(message=custom_message)
130
+ return handle_error(message=custom_message, include_traceback=include_error_traceback)
119
131
 
120
132
  console = Console()
121
133
  with Progress(
@@ -128,12 +140,14 @@ def run_progress_task(
128
140
  task = progress.add_task(description, status="In Progress", total=None)
129
141
  try:
130
142
  result = operation(*args, **kwargs)
131
- progress.update(task, completed=100, status="Done")
143
+ _update_completed_task(progress, task, success=True)
132
144
  return result
133
145
  except Exception as err: # pylint: disable=broad-exception-caught
134
- progress.update(task, completed=100, status="Failed")
146
+ _update_completed_task(progress, task, success=False)
135
147
  custom_message = error_message if error_message else str(err)
136
- return handle_error(message=custom_message)
148
+ return handle_error(message=custom_message, include_traceback=include_error_traceback)
149
+ finally:
150
+ progress.remove_task(task)
137
151
 
138
152
 
139
153
  def _format_list_items(items: list[str]) -> str:
@@ -120,7 +120,7 @@ def jobs_list(
120
120
  header_1 = "Job ID"
121
121
  header_2 = "Submitted"
122
122
  header_3 = "Status"
123
- console.print(f"\n[bold]{header_1.ljust(spacing)}{header_2.ljust(36)}{header_3}[/bold]")
123
+ console.print(f"[bold]{header_1.ljust(spacing)}{header_2.ljust(36)}{header_3}[/bold]")
124
124
  for job_id, submitted, status in job_data:
125
125
  if status == "COMPLETED":
126
126
  status_color = "green"
@@ -103,7 +103,7 @@ def confirm_updates(
103
103
  else:
104
104
  raise ValueError(f"Invalid mode: {mode}. Expected 'enable' or 'disable'.")
105
105
 
106
- typer.echo(f"\n==> WARNING: {provider}/{core_package} package required <==")
106
+ typer.echo(f"==> WARNING: {provider}/{core_package} package required <==")
107
107
  if (
108
108
  installed_version is not None
109
109
  and target_version is not None
@@ -6,10 +6,12 @@ Entrypoint for the qBraid CLI.
6
6
 
7
7
  """
8
8
 
9
+ import rich
9
10
  import typer
10
11
 
11
12
  from qbraid_cli.account.app import account_app
12
13
  from qbraid_cli.admin.app import admin_app
14
+ from qbraid_cli.chat.app import chat_app
13
15
  from qbraid_cli.configure.app import configure_app
14
16
  from qbraid_cli.devices.app import devices_app
15
17
  from qbraid_cli.jobs.app import jobs_app
@@ -26,6 +28,7 @@ except ImportError:
26
28
  app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
27
29
 
28
30
  app.add_typer(admin_app, name="admin")
31
+ app.add_typer(chat_app, name="chat")
29
32
  app.add_typer(configure_app, name="configure")
30
33
  app.add_typer(account_app, name="account")
31
34
  app.add_typer(devices_app, name="devices")
@@ -67,7 +70,7 @@ def show_banner():
67
70
  typer.echo("")
68
71
  typer.echo("- Use 'qbraid --version' to see the current version.")
69
72
  typer.echo("")
70
- typer.echo("Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid")
73
+ rich.print("Reference Docs: https://docs.qbraid.com/cli/api-reference/qbraid")
71
74
 
72
75
 
73
76
  @app.callback(invoke_without_command=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.9.0a0
3
+ Version: 0.9.1
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
  License-File: LICENSE
30
30
  Requires-Dist: typer>=0.12.1
31
31
  Requires-Dist: rich>=10.11.0
32
- Requires-Dist: qbraid-core>=0.1.28
32
+ Requires-Dist: qbraid-core>=0.1.30
33
33
  Provides-Extra: jobs
34
34
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
35
  Provides-Extra: envs
@@ -11,6 +11,7 @@ pyproject.toml
11
11
  .github/ISSUE_TEMPLATE/bug_report.yml
12
12
  .github/ISSUE_TEMPLATE/feature_request.yml
13
13
  .github/workflows/bump-version.yml
14
+ .github/workflows/docs-pr.yml
14
15
  .github/workflows/docs.yml
15
16
  .github/workflows/format.yml
16
17
  .github/workflows/main.yml
@@ -44,6 +45,8 @@ qbraid_cli/admin/__init__.py
44
45
  qbraid_cli/admin/app.py
45
46
  qbraid_cli/admin/headers.py
46
47
  qbraid_cli/admin/validation.py
48
+ qbraid_cli/chat/__init__.py
49
+ qbraid_cli/chat/app.py
47
50
  qbraid_cli/configure/__init__.py
48
51
  qbraid_cli/configure/actions.py
49
52
  qbraid_cli/configure/app.py
@@ -65,6 +68,7 @@ qbraid_cli/pip/__init__.py
65
68
  qbraid_cli/pip/app.py
66
69
  qbraid_cli/pip/hooks.py
67
70
  tests/__init__.py
71
+ tests/conftest.py
68
72
  tests/account/__init__.py
69
73
  tests/account/test_account_credits.py
70
74
  tests/admin/test_headers.py
@@ -1,6 +1,6 @@
1
1
  typer>=0.12.1
2
2
  rich>=10.11.0
3
- qbraid-core>=0.1.28
3
+ qbraid-core>=0.1.30
4
4
 
5
5
  [dev]
6
6
  isort
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Configurations for pytest including remote test marker and command-line option.
6
+
7
+ """
8
+ import os
9
+
10
+ import pytest
11
+
12
+
13
+ def pytest_addoption(parser):
14
+ """Adds custom remote testing command-line option to pytest."""
15
+ parser.addoption(
16
+ "--remote",
17
+ action="store",
18
+ default=None,
19
+ help="Run tests that interface with remote, credentialed services: true or false",
20
+ )
21
+
22
+
23
+ def pytest_collection_modifyitems(config, items):
24
+ """Skip tests marked with `remote` if remote tests are disabled."""
25
+ remote_option = config.getoption("--remote")
26
+ if remote_option is None:
27
+ remote_option = os.getenv("QBRAID_RUN_REMOTE_TESTS", "True").lower() == "true"
28
+ else:
29
+ remote_option = remote_option.lower() == "true"
30
+
31
+ if not remote_option:
32
+ skip_remote = pytest.mark.skip(reason="Remote tests are disabled.")
33
+ for item in items:
34
+ if "remote" in item.keywords:
35
+ item.add_marker(skip_remote)
@@ -6,27 +6,20 @@ Unit tests for the devices_list function in the devices app.
6
6
 
7
7
  """
8
8
 
9
- import os
10
9
  from unittest.mock import MagicMock, patch
11
10
 
12
11
  import pytest
13
- from qbraid_core import QbraidSession
14
12
  from qbraid_core.services.quantum.exceptions import QuantumServiceRequestError
15
13
  from typer.testing import CliRunner
16
14
 
17
15
  from qbraid_cli.devices.app import devices_list
18
16
 
19
- qbraidrc_path = os.path.join(os.path.expanduser("~"), ".qbraid", "qbraidrc")
20
- qbraid_api_key = os.getenv("QBRAID_API_KEY")
21
-
22
17
  runner = CliRunner()
23
18
 
24
19
 
20
+ @pytest.mark.remote
25
21
  def test_devices_list_no_results():
26
22
  """Test when no results are returned from the API."""
27
- session = QbraidSession(api_key=qbraid_api_key)
28
- session.save_config(api_key=qbraid_api_key)
29
-
30
23
  with (
31
24
  patch("qbraid_core.services.quantum.process_job_data", return_value=([], 0)),
32
25
  patch("rich.console.Console.print") as mock_console_print,
@@ -35,6 +28,7 @@ def test_devices_list_no_results():
35
28
  assert "No results matching given criteria" in str(mock_console_print.call_args)
36
29
 
37
30
 
31
+ @pytest.mark.remote
38
32
  def test_quantum_client_search_devices_failure():
39
33
  """Test that QuantumClient.search_devices correctly raises an exception."""
40
34
  with patch(
@@ -44,16 +38,12 @@ def test_quantum_client_search_devices_failure():
44
38
  with pytest.raises(QuantumServiceRequestError) as exc_info:
45
39
  devices_list()
46
40
 
47
- # Assert the expected exception message
48
41
  assert str(exc_info.value) == "Failed to fetch device data"
49
42
 
50
43
 
44
+ @pytest.mark.remote
51
45
  def test_devices_list_error_handling():
52
46
  """Test error handling when an error occurs during device data retrieval."""
53
- # Setup the initial session configuration
54
- session = QbraidSession(api_key=qbraid_api_key)
55
- session.save_config(api_key=qbraid_api_key)
56
-
57
47
  with (
58
48
  patch("qbraid_cli.handlers.run_progress_task", return_value=(MagicMock(), MagicMock())),
59
49
  patch(
@@ -67,11 +57,9 @@ def test_devices_list_error_handling():
67
57
  assert str(exc_info.value) == "Failed to fetch device data."
68
58
 
69
59
 
60
+ @pytest.mark.remote
70
61
  def test_output_formatting_console():
71
62
  """Test the output formatting in the console."""
72
- session = QbraidSession(api_key=qbraid_api_key)
73
- session.save_config(api_key=qbraid_api_key)
74
-
75
63
  mock_device_data = [("AWS", "Quantum Computer", "dev_123", "ONLINE")]
76
64
 
77
65
  with (
@@ -6,22 +6,16 @@ Unit tests for the `jobs_list` function in the `qbraid_cli.jobs.app` module.
6
6
 
7
7
  """
8
8
 
9
- import os
10
9
  from unittest.mock import patch
11
10
 
12
- from qbraid_core import QbraidSession
11
+ import pytest
13
12
 
14
13
  from qbraid_cli.jobs.app import jobs_list
15
14
 
16
- qbraidrc_path = os.path.join(os.path.expanduser("~"), ".qbraid", "qbraidrc")
17
- qbraid_api_key = os.getenv("QBRAID_API_KEY")
18
-
19
15
 
16
+ @pytest.mark.remote
20
17
  def test_jobs_list_with_limit():
21
18
  """Test the `jobs_list` function with a limit parameter."""
22
- session = QbraidSession(api_key=qbraid_api_key)
23
- session.save_config(api_key=qbraid_api_key)
24
-
25
19
  mock_raw_data = [
26
20
  ("job_id_1", "2023-03-19 12:00", "COMPLETED"),
27
21
  ("job_id_2", "2023-03-18 11:00", "FAILED"),
@@ -41,11 +35,9 @@ def test_jobs_list_with_limit():
41
35
  ), "Console should print each job and possibly more for headers/executable."
42
36
 
43
37
 
38
+ @pytest.mark.remote
44
39
  def test_jobs_list_output_formatting_console():
45
40
  """Test the jobs list output formatting in the console."""
46
- session = QbraidSession(api_key=qbraid_api_key)
47
- session.save_config(api_key=qbraid_api_key)
48
-
49
41
  mock_raw_data = [("job_id_1", "2023-03-19 12:00", "COMPLETED")]
50
42
  mock_message = f"Displaying {len(mock_raw_data)} most recent jobs"
51
43
  mock_job_data = (mock_raw_data, mock_message)
@@ -55,6 +47,4 @@ def test_jobs_list_output_formatting_console():
55
47
  patch("rich.console.Console.print") as mock_console_print,
56
48
  ):
57
49
  jobs_list(limit=1)
58
-
59
- # Assuming here that if `Console.print` is called, formatting has been attempted
60
50
  mock_console_print.assert_called()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes