qbraid-cli 0.9.9__tar.gz → 0.10.0__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 (121) hide show
  1. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/ci-pr-target.yml +1 -1
  2. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/main.yml +1 -1
  3. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/PKG-INFO +1 -1
  4. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/pyproject.toml +1 -1
  5. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/_version.py +2 -2
  6. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/admin/app.py +1 -1
  7. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/admin/headers.py +51 -1
  8. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/files/app.py +22 -1
  9. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/PKG-INFO +1 -1
  10. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/files/test_files_commands.py +41 -2
  11. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.env.example +0 -0
  12. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  13. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  14. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  15. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/dependabot.yml +0 -0
  16. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/bump-version.yml +0 -0
  17. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/docs-pr.yml +0 -0
  18. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/docs.yml +0 -0
  19. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/format.yml +0 -0
  20. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/pre-release.yml +0 -0
  21. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/publish.yml +0 -0
  22. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.github/workflows/tag-on-merge.yml +0 -0
  23. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.gitignore +0 -0
  24. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/.readthedocs.yml +0 -0
  25. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/CONTRIBUTING.md +0 -0
  26. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/LICENSE +0 -0
  27. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/MANIFEST.IN +0 -0
  28. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/Makefile +0 -0
  29. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/README.md +0 -0
  30. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/Makefile +0 -0
  31. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/_static/favicon.ico +0 -0
  32. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/_static/logo.png +0 -0
  33. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/_static/style/custom.css +0 -0
  34. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/_static/style/s4defs-roles.css +0 -0
  35. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/conf.py +0 -0
  36. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/index.rst +0 -0
  37. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/make.bat +0 -0
  38. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/docs/requirements.txt +0 -0
  39. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/__init__.py +0 -0
  40. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/account/__init__.py +0 -0
  41. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/account/app.py +0 -0
  42. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/admin/__init__.py +0 -0
  43. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/admin/validation.py +0 -0
  44. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/chat/__init__.py +0 -0
  45. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/chat/app.py +0 -0
  46. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/configure/__init__.py +0 -0
  47. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/configure/actions.py +0 -0
  48. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/configure/app.py +0 -0
  49. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/devices/__init__.py +0 -0
  50. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/devices/app.py +0 -0
  51. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/devices/validation.py +0 -0
  52. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/envs/__init__.py +0 -0
  53. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/envs/activate.py +0 -0
  54. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/envs/app.py +0 -0
  55. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/envs/create.py +0 -0
  56. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/envs/data_handling.py +0 -0
  57. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/exceptions.py +0 -0
  58. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/files/__init__.py +0 -0
  59. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/handlers.py +0 -0
  60. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/jobs/__init__.py +0 -0
  61. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/jobs/app.py +0 -0
  62. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/jobs/toggle_braket.py +0 -0
  63. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/jobs/validation.py +0 -0
  64. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/kernels/__init__.py +0 -0
  65. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/kernels/app.py +0 -0
  66. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/main.py +0 -0
  67. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/pip/__init__.py +0 -0
  68. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/pip/app.py +0 -0
  69. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/pip/hooks.py +0 -0
  70. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli/py.typed +0 -0
  71. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/SOURCES.txt +0 -0
  72. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/dependency_links.txt +0 -0
  73. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/entry_points.txt +0 -0
  74. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/requires.txt +0 -0
  75. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/qbraid_cli.egg-info/top_level.txt +0 -0
  76. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/setup.cfg +0 -0
  77. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/__init__.py +0 -0
  78. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/account/__init__.py +0 -0
  79. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/account/test_account_credits.py +0 -0
  80. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/admin/test_headers.py +0 -0
  81. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/configure/__init__.py +0 -0
  82. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/configure/test_configure_commands.py +0 -0
  83. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/configure/test_configure_prompt_for_config.py +0 -0
  84. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/configure/test_configure_set.py +0 -0
  85. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/configure/test_configure_validate_input.py +0 -0
  86. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/conftest.py +0 -0
  87. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/devices/__init__.py +0 -0
  88. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/devices/test_devices_list.py +0 -0
  89. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/devices/test_devices_validations.py +0 -0
  90. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/__init__.py +0 -0
  91. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_activate.py +0 -0
  92. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_activate_find_shell_rc.py +0 -0
  93. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_activate_print_command.py +0 -0
  94. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_activate_pyenv.py +0 -0
  95. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_create_from_yaml.py +0 -0
  96. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_list.py +0 -0
  97. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/envs/test_envs_remove.py +0 -0
  98. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/files/__init__.py +0 -0
  99. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/__init__.py +0 -0
  100. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_disable.py +0 -0
  101. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_enable.py +0 -0
  102. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_list.py +0 -0
  103. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_state.py +0 -0
  104. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_toggle_braket_confirm.py +0 -0
  105. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_toggle_braket_disable.py +0 -0
  106. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_toggle_braket_enable.py +0 -0
  107. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_toggle_braket_get_data.py +0 -0
  108. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_validate_get_state.py +0 -0
  109. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_validate_handle_state.py +0 -0
  110. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/jobs/test_jobs_validate_library.py +0 -0
  111. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/kernels/__init__.py +0 -0
  112. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/kernels/test_kernels_list.py +0 -0
  113. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/resources/envs/correct.yaml +0 -0
  114. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/resources/envs/icon.png +0 -0
  115. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tests/resources/envs/incorrect.yaml +0 -0
  116. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/bump_version.py +0 -0
  117. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/create_dev_build.sh +0 -0
  118. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/install_wheel_extras.sh +0 -0
  119. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/split_md.py +0 -0
  120. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/split_rst.py +0 -0
  121. {qbraid_cli-0.9.9 → qbraid_cli-0.10.0}/tools/stamp_pre_release.py +0 -0
@@ -73,7 +73,7 @@ jobs:
73
73
  QBRAID_API_KEY: ${{ secrets.QBRAID_API_KEY }}
74
74
  - name: Upload coverage to Codecov
75
75
  if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
76
- uses: codecov/codecov-action@v5.1.2
76
+ uses: codecov/codecov-action@v5.3.1
77
77
  with:
78
78
  token: ${{ secrets.CODECOV_TOKEN }}
79
79
  fail_ci_if_error: false
@@ -76,7 +76,7 @@ jobs:
76
76
  QBRAID_API_KEY: ${{ secrets.QBRAID_API_KEY }}
77
77
  - name: Upload coverage to Codecov
78
78
  if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
79
- uses: codecov/codecov-action@v5.1.2
79
+ uses: codecov/codecov-action@v5.3.1
80
80
  with:
81
81
  token: ${{ secrets.CODECOV_TOKEN }}
82
82
  fail_ci_if_error: false
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: qbraid-cli
3
- Version: 0.9.9
3
+ Version: 0.10.0
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qbraid-cli"
7
- version = "0.9.9"
7
+ version = "0.10.0"
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" }]
@@ -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+gf53eaff'
16
- __version_tuple__ = version_tuple = (0, 1, 'dev1', 'gf53eaff')
15
+ __version__ = version = '0.1.dev1+gc13e57e'
16
+ __version_tuple__ = version_tuple = (0, 1, 'dev1', 'gc13e57e')
@@ -35,7 +35,7 @@ def admin_headers(
35
35
  False, "--fix", "-f", help="Whether to fix the headers instead of just verifying."
36
36
  ),
37
37
  project_name: Optional[str] = typer.Option(
38
- "the qBraid-SDK", "--project", "-p", help="Name of the project to use in the header."
38
+ None, "--project", "-p", help="Name of the project to use in the header."
39
39
  ),
40
40
  ):
41
41
  """
@@ -10,6 +10,7 @@ Script to verify qBraid copyright file headers
10
10
 
11
11
  import datetime
12
12
  import os
13
+ import warnings
13
14
  from enum import Enum
14
15
  from pathlib import Path
15
16
  from typing import Optional
@@ -36,6 +37,8 @@ class HeaderType(Enum):
36
37
 
37
38
  default = "default" # pylint: disable=invalid-name
38
39
  gpl = "gpl" # pylint: disable=invalid-name
40
+ apache = "apache" # pylint: disable=invalid-name
41
+ mit = "mit" # pylint: disable=invalid-name
39
42
 
40
43
 
41
44
  DEFAULT_HEADER = f"""# Copyright (c) {CURR_YEAR}, qBraid Development Team
@@ -53,13 +56,53 @@ DEFAULT_HEADER_GPL = f"""# Copyright (C) {CURR_YEAR} qBraid
53
56
  # THERE IS NO WARRANTY for {{project_name}}, as per Section 15 of the GPL v3.
54
57
  """
55
58
 
59
+ DEFAULT_HEADER_APACHE = f"""# Copyright {CURR_YEAR} qBraid
60
+ #
61
+ # Licensed under the Apache License, Version 2.0 (the "License");
62
+ # you may not use this file except in compliance with the License.
63
+ # You may obtain a copy of the License at
64
+ #
65
+ # http://www.apache.org/licenses/LICENSE-2.0
66
+ #
67
+ # Unless required by applicable law or agreed to in writing, software
68
+ # distributed under the License is distributed on an "AS IS" BASIS,
69
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
70
+ # See the License for the specific language governing permissions and
71
+ # limitations under the License.
72
+ """
73
+
74
+ DEFAULT_HEADER_MIT = f"""# MIT License
75
+ #
76
+ # Copyright (c) {CURR_YEAR} qBraid
77
+ #
78
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
79
+ # of this software and associated documentation files (the "Software"), to deal
80
+ # in the Software without restriction, including without limitation the rights
81
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
82
+ # copies of the Software, and to permit persons to whom the Software is
83
+ # furnished to do so, subject to the following conditions:
84
+ #
85
+ # The above copyright notice and this permission notice shall be included in all
86
+ # copies or substantial portions of the Software.
87
+ #
88
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
91
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
92
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
93
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
94
+ # SOFTWARE.
95
+ """
96
+
56
97
  HEADER_TYPES = {
57
98
  HeaderType.default: DEFAULT_HEADER,
58
99
  HeaderType.gpl: DEFAULT_HEADER_GPL,
100
+ HeaderType.apache: DEFAULT_HEADER_APACHE,
101
+ HeaderType.mit: DEFAULT_HEADER_MIT,
59
102
  }
60
103
 
61
104
 
62
- def get_formatted_header(header_type: HeaderType, project_name: str) -> str:
105
+ def get_formatted_header(header_type: HeaderType, project_name: Optional[str] = None) -> str:
63
106
  """Get the formatted header based on the header type
64
107
 
65
108
  Args:
@@ -72,12 +115,19 @@ def get_formatted_header(header_type: HeaderType, project_name: str) -> str:
72
115
 
73
116
  header = HEADER_TYPES[header_type]
74
117
  if header_type == HeaderType.gpl:
118
+ if project_name is None:
119
+ raise ValueError("Project name is required for GPL header")
120
+
75
121
  if project_name.split(" ")[0].lower() == "the":
76
122
  project_name = project_name[:1].lower() + project_name[1:]
77
123
  project_name_start = project_name[:1].upper() + project_name[1:]
78
124
  else:
79
125
  project_name_start = project_name
80
126
  return header.format(project_name=project_name, project_name_start=project_name_start)
127
+
128
+ if project_name is not None:
129
+ warnings.warn(f"Project name is not used for header type '{header_type}'.", UserWarning)
130
+
81
131
  return header
82
132
 
83
133
 
@@ -12,11 +12,29 @@ from typing import Any
12
12
  import rich
13
13
  import typer
14
14
 
15
- from qbraid_cli.handlers import run_progress_task
15
+ from qbraid_cli.handlers import handle_error, run_progress_task
16
16
 
17
17
  files_app = typer.Typer(help="Manage qBraid cloud storage files.", no_args_is_help=True)
18
18
 
19
19
 
20
+ def is_file_less_than_10mb(file_path: Path) -> bool:
21
+ """
22
+ Check if the given file is less than 10MB in size.
23
+
24
+ Args:
25
+ file_path (Path): The path to the file to check.
26
+
27
+ Returns:
28
+ bool: True if the file is less than 10MB, False otherwise.
29
+ """
30
+ TEN_MB = 10 * 1024 * 1024 # 10 * 1024 KB * 1024 bytes
31
+
32
+ try:
33
+ return file_path.stat().st_size < TEN_MB
34
+ except OSError:
35
+ return False
36
+
37
+
20
38
  @files_app.command(name="upload")
21
39
  def files_upload(
22
40
  filepath: Path = typer.Argument(
@@ -47,6 +65,9 @@ def files_upload(
47
65
  ):
48
66
  """Upload a local file to qBraid storage."""
49
67
 
68
+ if not is_file_less_than_10mb(filepath):
69
+ handle_error("Error", "File too large. Must be less than 10MB for direct upload.")
70
+
50
71
  def upload_file() -> dict[str, Any]:
51
72
  from qbraid_core.services.files import FileManagerClient
52
73
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: qbraid-cli
3
- Version: 0.9.9
3
+ Version: 0.10.0
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
@@ -8,12 +8,13 @@ Unit tests for the `qbraid_cli.files.app` module.
8
8
 
9
9
  """
10
10
 
11
- from unittest.mock import patch
11
+ from pathlib import Path
12
+ from unittest.mock import Mock, patch
12
13
 
13
14
  import pytest
14
15
  from typer.testing import CliRunner
15
16
 
16
- from qbraid_cli.files.app import files_app
17
+ from qbraid_cli.files.app import files_app, is_file_less_than_10mb
17
18
 
18
19
 
19
20
  @pytest.fixture
@@ -107,3 +108,41 @@ def test_files_download_with_options(runner, tmp_path):
107
108
  assert result.exit_code == 0
108
109
  assert "File downloaded successfully!" in result.stdout
109
110
  assert f"Saved to: '{(save_path / 'downloaded_file.txt')}'" in result.stdout.replace("\n", "")
111
+
112
+
113
+ def test_is_file_less_than_10mb_small_file(tmp_path):
114
+ """Test is_file_less_than_10mb with a file smaller than 10MB."""
115
+ test_file = tmp_path / "small_file.txt"
116
+ test_file.write_text("Small file content") # Creates a small file
117
+
118
+ assert is_file_less_than_10mb(test_file) is True
119
+
120
+
121
+ def test_is_file_less_than_10mb_large_file(tmp_path):
122
+ """Test is_file_less_than_10mb with a file larger than 10MB."""
123
+ test_file = tmp_path / "large_file.txt"
124
+
125
+ # Mock the file stat to return size > 10MB
126
+ mock_stat = Mock()
127
+ mock_stat.st_size = 11 * 1024 * 1024 # 11MB
128
+
129
+ with patch.object(Path, "stat", return_value=mock_stat):
130
+ assert is_file_less_than_10mb(test_file) is False
131
+
132
+
133
+ def test_is_file_less_than_10mb_nonexistent_file(tmp_path):
134
+ """Test is_file_less_than_10mb with a nonexistent file."""
135
+ nonexistent_file = tmp_path / "nonexistent.txt"
136
+ assert is_file_less_than_10mb(nonexistent_file) is False
137
+
138
+
139
+ def test_is_file_less_than_10mb_exactly_10mb(tmp_path):
140
+ """Test is_file_less_than_10mb with a file exactly 10MB."""
141
+ test_file = tmp_path / "exact_10mb.txt"
142
+
143
+ # Mock the file stat to return size = 10MB
144
+ mock_stat = Mock()
145
+ mock_stat.st_size = 10 * 1024 * 1024 # 10MB
146
+
147
+ with patch.object(Path, "stat", return_value=mock_stat):
148
+ assert is_file_less_than_10mb(test_file) is False
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