qbraid-cli 0.9.1__tar.gz → 0.9.3__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 (115) hide show
  1. {qbraid_cli-0.9.1/qbraid_cli.egg-info → qbraid_cli-0.9.3}/PKG-INFO +3 -2
  2. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/index.rst +2 -1
  3. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/pyproject.toml +3 -2
  4. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/_version.py +2 -2
  5. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/account/app.py +1 -1
  6. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/admin/app.py +3 -1
  7. qbraid_cli-0.9.3/qbraid_cli/chat/__init__.py +11 -0
  8. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/chat/app.py +26 -46
  9. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/devices/app.py +1 -1
  10. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/envs/app.py +1 -1
  11. qbraid_cli-0.9.3/qbraid_cli/files/__init__.py +11 -0
  12. qbraid_cli-0.9.3/qbraid_cli/files/app.py +118 -0
  13. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/jobs/app.py +1 -1
  14. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/kernels/app.py +1 -1
  15. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/main.py +41 -10
  16. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/pip/app.py +1 -2
  17. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3/qbraid_cli.egg-info}/PKG-INFO +3 -2
  18. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli.egg-info/SOURCES.txt +4 -0
  19. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli.egg-info/requires.txt +2 -1
  20. qbraid_cli-0.9.3/tests/files/test_files_commands.py +109 -0
  21. qbraid_cli-0.9.3/tests/kernels/__init__.py +0 -0
  22. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/split_md.py +2 -0
  23. qbraid_cli-0.9.1/qbraid_cli/chat/__init__.py +0 -11
  24. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.env.example +0 -0
  25. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  26. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  27. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  28. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/bump-version.yml +0 -0
  29. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/docs-pr.yml +0 -0
  30. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/docs.yml +0 -0
  31. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/format.yml +0 -0
  32. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/main.yml +0 -0
  33. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/pre-release.yml +0 -0
  34. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/publish.yml +0 -0
  35. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.github/workflows/tag-on-merge.yml +0 -0
  36. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.gitignore +0 -0
  37. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/.readthedocs.yml +0 -0
  38. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/CONTRIBUTING.md +0 -0
  39. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/LICENSE +0 -0
  40. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/MANIFEST.IN +0 -0
  41. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/Makefile +0 -0
  42. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/README.md +0 -0
  43. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/Makefile +0 -0
  44. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/_static/favicon.ico +0 -0
  45. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/_static/logo.png +0 -0
  46. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/_static/style/custom.css +0 -0
  47. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/_static/style/s4defs-roles.css +0 -0
  48. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/conf.py +0 -0
  49. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/make.bat +0 -0
  50. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/docs/requirements.txt +0 -0
  51. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/__init__.py +0 -0
  52. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/account/__init__.py +0 -0
  53. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/admin/__init__.py +0 -0
  54. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/admin/headers.py +0 -0
  55. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/admin/validation.py +0 -0
  56. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/configure/__init__.py +0 -0
  57. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/configure/actions.py +0 -0
  58. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/configure/app.py +0 -0
  59. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/devices/__init__.py +0 -0
  60. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/devices/validation.py +0 -0
  61. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/envs/__init__.py +0 -0
  62. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/envs/activate.py +0 -0
  63. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/envs/create.py +0 -0
  64. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/envs/data_handling.py +0 -0
  65. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/exceptions.py +0 -0
  66. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/handlers.py +0 -0
  67. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/jobs/__init__.py +0 -0
  68. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/jobs/toggle_braket.py +0 -0
  69. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/jobs/validation.py +0 -0
  70. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/kernels/__init__.py +0 -0
  71. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/pip/__init__.py +0 -0
  72. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/pip/hooks.py +0 -0
  73. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli/py.typed +0 -0
  74. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli.egg-info/dependency_links.txt +0 -0
  75. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli.egg-info/entry_points.txt +0 -0
  76. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/qbraid_cli.egg-info/top_level.txt +0 -0
  77. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/setup.cfg +0 -0
  78. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/__init__.py +0 -0
  79. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/account/__init__.py +0 -0
  80. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/account/test_account_credits.py +0 -0
  81. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/admin/test_headers.py +0 -0
  82. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/configure/__init__.py +0 -0
  83. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/configure/test_configure_prompt_for_config.py +0 -0
  84. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/configure/test_configure_set.py +0 -0
  85. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/configure/test_configure_validate_input.py +0 -0
  86. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/conftest.py +0 -0
  87. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/devices/__init__.py +0 -0
  88. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/devices/test_devices_list.py +0 -0
  89. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/devices/test_devices_validations.py +0 -0
  90. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/__init__.py +0 -0
  91. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_activate.py +0 -0
  92. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_activate_find_shell_rc.py +0 -0
  93. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_activate_print_command.py +0 -0
  94. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_activate_pyenv.py +0 -0
  95. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_list.py +0 -0
  96. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/envs/test_envs_remove.py +0 -0
  97. {qbraid_cli-0.9.1/tests/jobs → qbraid_cli-0.9.3/tests/files}/__init__.py +0 -0
  98. {qbraid_cli-0.9.1/tests/kernels → qbraid_cli-0.9.3/tests/jobs}/__init__.py +0 -0
  99. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_disable.py +0 -0
  100. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_enable.py +0 -0
  101. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_list.py +0 -0
  102. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_state.py +0 -0
  103. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_toggle_braket_confirm.py +0 -0
  104. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_toggle_braket_disable.py +0 -0
  105. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_toggle_braket_enable.py +0 -0
  106. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_toggle_braket_get_data.py +0 -0
  107. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_validate_get_state.py +0 -0
  108. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_validate_handle_state.py +0 -0
  109. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/jobs/test_jobs_validate_library.py +0 -0
  110. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tests/kernels/test_kernels_list.py +0 -0
  111. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/bump_version.py +0 -0
  112. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/create_dev_build.sh +0 -0
  113. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/install_wheel_extras.sh +0 -0
  114. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/split_rst.py +0 -0
  115. {qbraid_cli-0.9.1 → qbraid_cli-0.9.3}/tools/stamp_pre_release.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.9.1
3
+ Version: 0.9.3
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,8 @@ 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.30
32
+ Requires-Dist: click
33
+ Requires-Dist: qbraid-core>=0.1.32
33
34
  Provides-Extra: jobs
34
35
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
36
  Provides-Extra: envs
@@ -121,4 +121,5 @@ by disabling quantum jobs:
121
121
  tree/qbraid_jobs
122
122
  tree/qbraid_kernels
123
123
  tree/qbraid_pip
124
- tree/qbraid_chat
124
+ tree/qbraid_chat
125
+ tree/qbraid_files
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qbraid-cli"
7
- version = "0.9.1"
7
+ version = "0.9.3"
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,8 @@ classifiers = [
30
30
  dependencies = [
31
31
  "typer>=0.12.1",
32
32
  "rich>=10.11.0",
33
- "qbraid-core>=0.1.30",
33
+ "click",
34
+ "qbraid-core>=0.1.32",
34
35
  ]
35
36
  requires-python = ">= 3.9"
36
37
 
@@ -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+gbfaed43'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev1', 'gbfaed43')
15
+ __version__ = version = '0.1.dev1+gb960e1f'
16
+ __version_tuple__ = version_tuple = (0, 1, 'dev1', 'gb960e1f')
@@ -13,7 +13,7 @@ import typer
13
13
 
14
14
  from qbraid_cli.handlers import run_progress_task
15
15
 
16
- account_app = typer.Typer(help="Manage qBraid account.")
16
+ account_app = typer.Typer(help="Manage qBraid account.", no_args_is_help=True)
17
17
 
18
18
 
19
19
  @account_app.command(name="credits")
@@ -14,7 +14,9 @@ from qbraid_cli.admin.headers import check_and_fix_headers
14
14
  from qbraid_cli.admin.validation import validate_header_type, validate_paths_exist
15
15
 
16
16
  admin_app = typer.Typer(
17
- help="CI/CD commands for qBraid maintainers.", pretty_exceptions_show_locals=False
17
+ help="CI/CD commands for qBraid maintainers.",
18
+ pretty_exceptions_show_locals=False,
19
+ no_args_is_help=True,
18
20
  )
19
21
 
20
22
 
@@ -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 ChatFormat, list_models_callback, prompt_callback
10
+
11
+ __all__ = ["list_models_callback", "prompt_callback", "ChatFormat"]
@@ -7,16 +7,11 @@ Module defining commands in the 'qbraid chat' namespace.
7
7
  """
8
8
  from enum import Enum
9
9
 
10
- import typer
11
10
  from rich.console import Console
12
11
  from rich.table import Table
13
12
 
14
13
  from qbraid_cli.handlers import handle_error, run_progress_task
15
14
 
16
- chat_app = typer.Typer(
17
- help="Interact with qBraid AI chat service.", pretty_exceptions_show_locals=False
18
- )
19
-
20
15
 
21
16
  class ChatFormat(str, Enum):
22
17
  """Format of the response from the chat service."""
@@ -25,47 +20,7 @@ class ChatFormat(str, Enum):
25
20
  code = "code" # pylint: disable=invalid-name
26
21
 
27
22
 
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():
23
+ def list_models_callback():
69
24
  """List available chat models."""
70
25
  # pylint: disable-next=import-outside-toplevel
71
26
  from qbraid_core.services.chat import ChatClient
@@ -94,3 +49,28 @@ def chat_models():
94
49
  )
95
50
 
96
51
  console.print(table)
52
+
53
+
54
+ def prompt_callback(prompt: str, model: str, response_format: ChatFormat, stream: bool):
55
+ """Send a chat prompt to the chat service."""
56
+ # pylint: disable-next=import-outside-toplevel
57
+ from qbraid_core.services.chat import ChatClient, ChatServiceRequestError
58
+
59
+ client = ChatClient()
60
+
61
+ if stream:
62
+ try:
63
+ for chunk in client.chat_stream(prompt, model, response_format):
64
+ print(chunk, end="")
65
+ except ChatServiceRequestError as err:
66
+ handle_error(message=str(err), include_traceback=False)
67
+ else:
68
+ content = run_progress_task(
69
+ client.chat,
70
+ prompt,
71
+ model,
72
+ response_format,
73
+ description="Connecting to chat service...",
74
+ include_error_traceback=False,
75
+ )
76
+ print(content)
@@ -14,7 +14,7 @@ from rich.console import Console
14
14
  from qbraid_cli.devices.validation import validate_provider, validate_status, validate_type
15
15
  from qbraid_cli.handlers import run_progress_task
16
16
 
17
- devices_app = typer.Typer(help="Manage qBraid quantum devices.")
17
+ devices_app = typer.Typer(help="Manage qBraid quantum devices.", no_args_is_help=True)
18
18
 
19
19
 
20
20
  @devices_app.command(name="list")
@@ -23,7 +23,7 @@ from qbraid_cli.handlers import QbraidException, run_progress_task
23
23
  if TYPE_CHECKING:
24
24
  from qbraid_core.services.environments.client import EnvironmentManagerClient as EMC
25
25
 
26
- envs_app = typer.Typer(help="Manage qBraid environments.")
26
+ envs_app = typer.Typer(help="Manage qBraid environments.", no_args_is_help=True)
27
27
 
28
28
 
29
29
  @envs_app.command(name="create")
@@ -0,0 +1,11 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining the qbraid files namespace
6
+
7
+ """
8
+
9
+ from .app import files_app
10
+
11
+ __all__ = ["files_app"]
@@ -0,0 +1,118 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ """
5
+ Module defining commands in the 'qbraid files' namespace.
6
+
7
+ """
8
+
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ import rich
13
+ import typer
14
+
15
+ from qbraid_cli.handlers import run_progress_task
16
+
17
+ files_app = typer.Typer(help="Manage qBraid cloud storage files.", no_args_is_help=True)
18
+
19
+
20
+ @files_app.command(name="upload")
21
+ def files_upload(
22
+ filepath: Path = typer.Argument(
23
+ ...,
24
+ exists=True,
25
+ dir_okay=False,
26
+ resolve_path=True,
27
+ help="Local path to the file to upload.",
28
+ ),
29
+ namespace: str = typer.Option(
30
+ "user",
31
+ "--namespace",
32
+ "-n",
33
+ help="Target qBraid namespace for the upload.",
34
+ ),
35
+ object_path: str = typer.Option(
36
+ None,
37
+ "--object-path",
38
+ "-p",
39
+ help=("Target object path. " "Defaults to original filename in namespace root."),
40
+ ),
41
+ overwrite: bool = typer.Option(
42
+ False,
43
+ "--overwrite",
44
+ "-o",
45
+ help="Overwrite existing file if it already exists in the target location.",
46
+ ),
47
+ ):
48
+ """Upload a local file to qBraid storage."""
49
+
50
+ def upload_file() -> dict[str, Any]:
51
+ from qbraid_core.services.files import FileManagerClient
52
+
53
+ client = FileManagerClient()
54
+ data = client.upload_file(
55
+ filepath, namespace=namespace, object_path=object_path, overwrite=overwrite
56
+ )
57
+ return data
58
+
59
+ data: dict = run_progress_task(
60
+ upload_file, description="Uploading file...", include_error_traceback=False
61
+ )
62
+
63
+ rich.print("File uploaded successfully!")
64
+ namespace = data.get("namespace")
65
+ object_path = data.get("objectPath")
66
+
67
+ if namespace and object_path:
68
+ rich.print(f"\nNamespace: '{namespace}'")
69
+ rich.print(f"Object path: '{object_path}'")
70
+
71
+
72
+ @files_app.command(name="download")
73
+ def files_download(
74
+ object_path: str = typer.Argument(
75
+ ...,
76
+ help="The folder + filename describing the file to download.",
77
+ ),
78
+ namespace: str = typer.Option(
79
+ "user",
80
+ "--namespace",
81
+ "-n",
82
+ help="Source qBraid namespace for the download.",
83
+ ),
84
+ save_path: Path = typer.Option(
85
+ Path.cwd(),
86
+ "--save-path",
87
+ "-s",
88
+ resolve_path=True,
89
+ help="Local directory to save the downloaded file.",
90
+ ),
91
+ overwrite: bool = typer.Option(
92
+ False,
93
+ "--overwrite",
94
+ "-o",
95
+ help="Overwrite existing file if it already exists in the target location.",
96
+ ),
97
+ ):
98
+ """Download a file from qBraid storage."""
99
+
100
+ def download_file() -> Path:
101
+ from qbraid_core.services.files import FileManagerClient
102
+
103
+ client = FileManagerClient()
104
+ file_path = client.download_file(
105
+ object_path, namespace=namespace, save_path=save_path, overwrite=overwrite
106
+ )
107
+ return file_path
108
+
109
+ file_path: Path = run_progress_task(
110
+ download_file, description="Downloading file...", include_error_traceback=False
111
+ )
112
+
113
+ rich.print("File downloaded successfully!")
114
+ rich.print(f"Saved to: '{str(file_path)}'")
115
+
116
+
117
+ if __name__ == "__main__":
118
+ files_app()
@@ -15,7 +15,7 @@ from qbraid_cli.handlers import handle_error, run_progress_task
15
15
  from qbraid_cli.jobs.toggle_braket import disable_braket, enable_braket
16
16
  from qbraid_cli.jobs.validation import handle_jobs_state, run_progress_get_state, validate_library
17
17
 
18
- jobs_app = typer.Typer(help="Manage qBraid quantum jobs.")
18
+ jobs_app = typer.Typer(help="Manage qBraid quantum jobs.", no_args_is_help=True)
19
19
 
20
20
 
21
21
  @jobs_app.command(name="enable")
@@ -11,7 +11,7 @@ from rich.console import Console
11
11
 
12
12
  from qbraid_cli.handlers import handle_error
13
13
 
14
- kernels_app = typer.Typer(help="Manage qBraid kernels.")
14
+ kernels_app = typer.Typer(help="Manage qBraid kernels.", no_args_is_help=True)
15
15
 
16
16
 
17
17
  @kernels_app.command(name="list")
@@ -6,20 +6,22 @@ Entrypoint for the qBraid CLI.
6
6
 
7
7
  """
8
8
 
9
+ import click
9
10
  import rich
10
11
  import typer
11
12
 
12
- from qbraid_cli.account.app import account_app
13
- from qbraid_cli.admin.app import admin_app
14
- from qbraid_cli.chat.app import chat_app
15
- from qbraid_cli.configure.app import configure_app
16
- from qbraid_cli.devices.app import devices_app
17
- from qbraid_cli.jobs.app import jobs_app
13
+ from qbraid_cli.account import account_app
14
+ from qbraid_cli.admin import admin_app
15
+ from qbraid_cli.chat import ChatFormat, list_models_callback, prompt_callback
16
+ from qbraid_cli.configure import configure_app
17
+ from qbraid_cli.devices import devices_app
18
+ from qbraid_cli.files import files_app
19
+ from qbraid_cli.jobs import jobs_app
18
20
 
19
21
  try:
20
- from qbraid_cli.envs.app import envs_app
21
- from qbraid_cli.kernels.app import kernels_app
22
- from qbraid_cli.pip.app import pip_app
22
+ from qbraid_cli.envs import envs_app
23
+ from qbraid_cli.kernels import kernels_app
24
+ from qbraid_cli.pip import pip_app
23
25
 
24
26
  ENVS_COMMANDS = True
25
27
  except ImportError:
@@ -28,10 +30,10 @@ except ImportError:
28
30
  app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
29
31
 
30
32
  app.add_typer(admin_app, name="admin")
31
- app.add_typer(chat_app, name="chat")
32
33
  app.add_typer(configure_app, name="configure")
33
34
  app.add_typer(account_app, name="account")
34
35
  app.add_typer(devices_app, name="devices")
36
+ app.add_typer(files_app, name="files")
35
37
  app.add_typer(jobs_app, name="jobs")
36
38
 
37
39
  if ENVS_COMMANDS is True:
@@ -90,5 +92,34 @@ def main(
90
92
  show_banner()
91
93
 
92
94
 
95
+ @app.command(help="Interact with qBraid AI chat service.", no_args_is_help=True)
96
+ def chat(
97
+ prompt: str = typer.Option(
98
+ None, "--prompt", "-p", help="The prompt to send to the chat service."
99
+ ),
100
+ model: str = typer.Option(None, "--model", "-m", help="The model to use for the chat service."),
101
+ response_format: ChatFormat = typer.Option(
102
+ ChatFormat.text, "--format", "-f", help="The format of the response."
103
+ ),
104
+ stream: bool = typer.Option(False, "--stream", "-s", help="Stream the response."),
105
+ list_models: bool = typer.Option(
106
+ False, "--list-models", "-l", help="List available chat models."
107
+ ),
108
+ ):
109
+ """
110
+ Interact with qBraid AI chat service.
111
+
112
+ """
113
+ if list_models:
114
+ list_models_callback()
115
+ elif prompt:
116
+ prompt_callback(prompt, model, response_format, stream)
117
+ else:
118
+ raise click.UsageError(
119
+ "Invalid command. Please provide a prompt using --prompt "
120
+ "or use --list-models to view available models."
121
+ )
122
+
123
+
93
124
  if __name__ == "__main__":
94
125
  app()
@@ -16,8 +16,7 @@ from qbraid_core.system.executables import get_active_python_path
16
16
  from qbraid_cli.handlers import handle_error
17
17
  from qbraid_cli.pip.hooks import get_env_cfg_path, safe_set_include_sys_packages
18
18
 
19
- # disable pretty_exceptions_show_locals to avoid printing sensative information in the traceback
20
- pip_app = typer.Typer(help="Run pip command in active qBraid environment.")
19
+ pip_app = typer.Typer(help="Run pip command in active qBraid environment.", no_args_is_help=True)
21
20
 
22
21
 
23
22
  @pip_app.command(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qbraid-cli
3
- Version: 0.9.1
3
+ Version: 0.9.3
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,8 @@ 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.30
32
+ Requires-Dist: click
33
+ Requires-Dist: qbraid-core>=0.1.32
33
34
  Provides-Extra: jobs
34
35
  Requires-Dist: amazon-braket-sdk>=1.48.1; extra == "jobs"
35
36
  Provides-Extra: envs
@@ -58,6 +58,8 @@ qbraid_cli/envs/activate.py
58
58
  qbraid_cli/envs/app.py
59
59
  qbraid_cli/envs/create.py
60
60
  qbraid_cli/envs/data_handling.py
61
+ qbraid_cli/files/__init__.py
62
+ qbraid_cli/files/app.py
61
63
  qbraid_cli/jobs/__init__.py
62
64
  qbraid_cli/jobs/app.py
63
65
  qbraid_cli/jobs/toggle_braket.py
@@ -86,6 +88,8 @@ tests/envs/test_envs_activate_print_command.py
86
88
  tests/envs/test_envs_activate_pyenv.py
87
89
  tests/envs/test_envs_list.py
88
90
  tests/envs/test_envs_remove.py
91
+ tests/files/__init__.py
92
+ tests/files/test_files_commands.py
89
93
  tests/jobs/__init__.py
90
94
  tests/jobs/test_jobs_disable.py
91
95
  tests/jobs/test_jobs_enable.py
@@ -1,6 +1,7 @@
1
1
  typer>=0.12.1
2
2
  rich>=10.11.0
3
- qbraid-core>=0.1.30
3
+ click
4
+ qbraid-core>=0.1.32
4
5
 
5
6
  [dev]
6
7
  isort
@@ -0,0 +1,109 @@
1
+ # Copyright (c) 2024, qBraid Development Team
2
+ # All rights reserved.
3
+
4
+ # pylint: disable=redefined-outer-name
5
+
6
+ """
7
+ Unit tests for the `qbraid_cli.files.app` module.
8
+
9
+ """
10
+
11
+ from unittest.mock import patch
12
+
13
+ import pytest
14
+ from typer.testing import CliRunner
15
+
16
+ from qbraid_cli.files.app import files_app
17
+
18
+
19
+ @pytest.fixture
20
+ def runner():
21
+ """Fixture for invoking CLI commands."""
22
+ return CliRunner()
23
+
24
+
25
+ def test_files_upload(runner, tmp_path):
26
+ """Test the `files upload` command."""
27
+ test_file = tmp_path / "test_file.txt"
28
+ test_file.write_text("Test content")
29
+
30
+ with patch("qbraid_core.services.files.FileManagerClient") as mock_client:
31
+ mock_client.return_value.upload_file.return_value = {
32
+ "namespace": "user",
33
+ "objectPath": "test_file.txt",
34
+ }
35
+
36
+ result = runner.invoke(files_app, ["upload", str(test_file)])
37
+
38
+ assert result.exit_code == 0
39
+ assert "File uploaded successfully!" in result.stdout
40
+ assert "Namespace: 'user'" in result.stdout
41
+ assert "Object path: 'test_file.txt'" in result.stdout
42
+
43
+
44
+ def test_files_upload_with_options(runner, tmp_path):
45
+ """Test the `files upload` command with options."""
46
+ test_file = tmp_path / "test_file.txt"
47
+ test_file.write_text("Test content")
48
+
49
+ with patch("qbraid_core.services.files.FileManagerClient") as mock_client:
50
+ mock_client.return_value.upload_file.return_value = {
51
+ "namespace": "custom",
52
+ "objectPath": "folder/test_file.txt",
53
+ }
54
+
55
+ result = runner.invoke(
56
+ files_app,
57
+ [
58
+ "upload",
59
+ str(test_file),
60
+ "--namespace",
61
+ "custom",
62
+ "--object-path",
63
+ "folder/test_file.txt",
64
+ "--overwrite",
65
+ ],
66
+ )
67
+
68
+ assert result.exit_code == 0
69
+ assert "File uploaded successfully!" in result.stdout
70
+ assert "Namespace: 'custom'" in result.stdout
71
+ assert "Object path: 'folder/test_file.txt'" in result.stdout
72
+
73
+
74
+ def test_files_download(runner, tmp_path):
75
+ """Test the `files download` command."""
76
+ with patch("qbraid_core.services.files.FileManagerClient") as mock_client:
77
+ mock_client.return_value.download_file.return_value = tmp_path / "downloaded_file.txt"
78
+
79
+ result = runner.invoke(files_app, ["download", "test_file.txt"])
80
+
81
+ assert result.exit_code == 0
82
+ assert "File downloaded successfully!" in result.stdout
83
+ assert f"Saved to: '{(tmp_path / 'downloaded_file.txt')}'" in result.stdout.replace("\n", "")
84
+
85
+
86
+ def test_files_download_with_options(runner, tmp_path):
87
+ """Test the `files download` command with options."""
88
+ save_path = tmp_path / "custom_folder"
89
+ save_path.mkdir()
90
+
91
+ with patch("qbraid_core.services.files.FileManagerClient") as mock_client:
92
+ mock_client.return_value.download_file.return_value = save_path / "downloaded_file.txt"
93
+
94
+ result = runner.invoke(
95
+ files_app,
96
+ [
97
+ "download",
98
+ "folder/test_file.txt",
99
+ "--namespace",
100
+ "custom",
101
+ "--save-path",
102
+ str(save_path),
103
+ "--overwrite",
104
+ ],
105
+ )
106
+
107
+ assert result.exit_code == 0
108
+ assert "File downloaded successfully!" in result.stdout
109
+ assert f"Saved to: '{(save_path / 'downloaded_file.txt')}'" in result.stdout.replace("\n", "")
File without changes
@@ -137,6 +137,8 @@ def markdown_to_mdx(file_path: str) -> None:
137
137
  )
138
138
  continue
139
139
 
140
+ line = line.replace("&#x27;", "'")
141
+
140
142
  new_lines.append(line)
141
143
 
142
144
  # Construct the new file path with .mdx extension
@@ -1,11 +0,0 @@
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"]
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
File without changes
File without changes
File without changes
File without changes