qbraid-cli 0.6.1__tar.gz → 0.7.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.
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/PKG-INFO +3 -2
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli/_version.py +1 -1
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli/bin/qbraid.sh +124 -43
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli/wrapper.py +42 -2
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/PKG-INFO +3 -2
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/SOURCES.txt +0 -1
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/requires.txt +2 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/setup.py +2 -3
- qbraid-cli-0.6.1/qbraid_cli/bin/banner.sh +0 -17
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/README.md +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli/__init__.py +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli/configure.py +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/dependency_links.txt +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/entry_points.txt +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/qbraid_cli.egg-info/top_level.txt +0 -0
- {qbraid-cli-0.6.1 → qbraid-cli-0.7.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Command Line Interface for interacting with all parts of the qBraid platform.
|
|
5
5
|
Home-page: https://www.qbraid.com/
|
|
6
6
|
Author: qBraid Development Team
|
|
@@ -16,14 +16,15 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
23
|
Requires-Python: >= 3.8
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: qbraid>=0.5.0
|
|
26
26
|
Requires-Dist: awscli
|
|
27
|
+
Requires-Dist: ipykernel
|
|
27
28
|
Provides-Extra: dev
|
|
28
29
|
Requires-Dist: black; extra == "dev"
|
|
29
30
|
Requires-Dist: isort; extra == "dev"
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
#-------------------------------------------------------------------------
|
|
11
11
|
# Global variables
|
|
12
12
|
|
|
13
|
-
# CLI version (DEPRECATED, now kept by python _version.py)
|
|
14
|
-
VERSION="0.6.0.dev0"
|
|
15
|
-
|
|
16
13
|
# Styling
|
|
17
14
|
NC="\033[0m" # No Color
|
|
18
15
|
PURPLE="\033[0;35m"
|
|
@@ -890,19 +887,6 @@ help_jobs_add() {
|
|
|
890
887
|
echo ""
|
|
891
888
|
}
|
|
892
889
|
|
|
893
|
-
# qbraid jobs get-credits -h
|
|
894
|
-
help_jobs_credits() {
|
|
895
|
-
echo ""
|
|
896
|
-
echo "Command"
|
|
897
|
-
echo " qbraid jobs get-credits : Get number of qBraid credits remaining."
|
|
898
|
-
echo " Recently added credits may not appear, but"
|
|
899
|
-
echo " will be synced after submitting quantum job."
|
|
900
|
-
echo ""
|
|
901
|
-
echo "Optional Arguments"
|
|
902
|
-
echo " -h, --help : Show this help message and exit."
|
|
903
|
-
echo ""
|
|
904
|
-
}
|
|
905
|
-
|
|
906
890
|
# qbraids jobs enable -h
|
|
907
891
|
help_jobs_enable() {
|
|
908
892
|
echo ""
|
|
@@ -962,15 +946,6 @@ jobs() {
|
|
|
962
946
|
((argDepth++))
|
|
963
947
|
if [ "$(help_command "${argDepth}")" = "yes" ]; then
|
|
964
948
|
help_jobs_list
|
|
965
|
-
else
|
|
966
|
-
awsJobs="$HOME/.qbraid/quantum-jobs/aws"
|
|
967
|
-
if [ ! -f "${awsJobs}" ] || [ "$(cat "${awsJobs}" | wc -l)" = 0 ]; then
|
|
968
|
-
echo -e "${RED}No quantum jobs found.${NC}"
|
|
969
|
-
echo ""
|
|
970
|
-
echo -e "Use \`qbraid jobs enable -h\` for information on enabling qBraid Quantum Jobs."
|
|
971
|
-
else
|
|
972
|
-
cat "${awsJobs}"
|
|
973
|
-
fi
|
|
974
949
|
fi
|
|
975
950
|
|
|
976
951
|
# qbraid jobs add
|
|
@@ -1148,6 +1123,66 @@ jobs() {
|
|
|
1148
1123
|
fi
|
|
1149
1124
|
}
|
|
1150
1125
|
|
|
1126
|
+
############################### DEVICES GROUP ###############################
|
|
1127
|
+
#-------------------------------------------------------------------------
|
|
1128
|
+
# Help functions
|
|
1129
|
+
|
|
1130
|
+
# qbraid devices -h
|
|
1131
|
+
help_devices() {
|
|
1132
|
+
echo ""
|
|
1133
|
+
echo "Group"
|
|
1134
|
+
echo " qbraid devices : Manage qBraid Quantum Devices."
|
|
1135
|
+
echo ""
|
|
1136
|
+
echo "Commands"
|
|
1137
|
+
echo " list : Get list of qBraid Quantum Devices."
|
|
1138
|
+
echo ""
|
|
1139
|
+
echo "Optional Arguments"
|
|
1140
|
+
echo " -h, --help : Show this help message and exit."
|
|
1141
|
+
echo ""
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
# qbraid devices list -h
|
|
1145
|
+
help_devices_list() {
|
|
1146
|
+
echo ""
|
|
1147
|
+
echo "Command"
|
|
1148
|
+
echo " qbraid devices list : Get list of qBraid Quantum Jobs."
|
|
1149
|
+
echo ""
|
|
1150
|
+
echo "Optional Arguments"
|
|
1151
|
+
echo " -h, --help : Show this help message and exit."
|
|
1152
|
+
echo ""
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
#-------------------------------------------------------------------------
|
|
1156
|
+
# qbraid devices commands
|
|
1157
|
+
|
|
1158
|
+
devices() {
|
|
1159
|
+
|
|
1160
|
+
argDepth=2
|
|
1161
|
+
|
|
1162
|
+
# qbraid jobs -h
|
|
1163
|
+
if [ "$(help_command "${argDepth}")" = "yes" ]; then
|
|
1164
|
+
help_devices
|
|
1165
|
+
|
|
1166
|
+
# qbraid jobs
|
|
1167
|
+
elif [ -z "${1}" ]; then
|
|
1168
|
+
echo -e "${RED}ERROR: Invalid command ${NC}"
|
|
1169
|
+
echo ""
|
|
1170
|
+
echo -e "Use \`qbraid devices -h\` to see available commands"
|
|
1171
|
+
exit 1
|
|
1172
|
+
|
|
1173
|
+
# qbraid devices list
|
|
1174
|
+
elif [ "${1}" = "list" ]; then
|
|
1175
|
+
((argDepth++))
|
|
1176
|
+
if [ "$(help_command "${argDepth}")" = "yes" ]; then
|
|
1177
|
+
help_devices_list
|
|
1178
|
+
fi
|
|
1179
|
+
else
|
|
1180
|
+
echo -e "${RED}ERROR: Invalid argument ${NC}${1}"
|
|
1181
|
+
echo ""
|
|
1182
|
+
echo -e "Use \`qbraid devices -h\` to see available commands"
|
|
1183
|
+
exit 1
|
|
1184
|
+
fi
|
|
1185
|
+
}
|
|
1151
1186
|
|
|
1152
1187
|
############################### CLI ENTRYPOINT ###########################
|
|
1153
1188
|
#-------------------------------------------------------------------------
|
|
@@ -1159,10 +1194,15 @@ help() {
|
|
|
1159
1194
|
echo "Group"
|
|
1160
1195
|
echo " qbraid"
|
|
1161
1196
|
echo ""
|
|
1197
|
+
echo "Commands"
|
|
1198
|
+
echo " configure : Update or add qbraidrc config values."
|
|
1199
|
+
echo " credits : Get number of qBraid credits remaining."
|
|
1200
|
+
echo ""
|
|
1162
1201
|
echo "Subgroups"
|
|
1163
1202
|
echo " envs : Manage qBraid environments."
|
|
1164
1203
|
echo " kernels : Manage qBraid kernels."
|
|
1165
1204
|
echo " jobs : Manage qBraid Quantum Jobs."
|
|
1205
|
+
echo " devices : Manage qBraid Quantum Devices."
|
|
1166
1206
|
echo ""
|
|
1167
1207
|
echo "Arguments"
|
|
1168
1208
|
echo " -V, --version : Show version and exit"
|
|
@@ -1170,7 +1210,34 @@ help() {
|
|
|
1170
1210
|
echo "Global Arguments"
|
|
1171
1211
|
echo " -h, --help : Show this help message and exit."
|
|
1172
1212
|
echo ""
|
|
1173
|
-
echo "Reference Docs: https://docs.qbraid.com/en/latest/cli/qbraid.html"
|
|
1213
|
+
echo "Reference Docs: https://docs.qbraid.com/projects/cli/en/latest/cli/qbraid.html"
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
# qbraid configure -h
|
|
1217
|
+
help_configure() {
|
|
1218
|
+
echo ""
|
|
1219
|
+
echo "Command"
|
|
1220
|
+
echo " qbraid configure : Update or add qbraidrc config values."
|
|
1221
|
+
echo ""
|
|
1222
|
+
echo "Optional Arguments"
|
|
1223
|
+
echo " -h, --help : Show this help message and exit."
|
|
1224
|
+
echo ""
|
|
1225
|
+
echo "Examples"
|
|
1226
|
+
echo " $ qbraid configure"
|
|
1227
|
+
echo " email [None]: contact@qbraid.com"
|
|
1228
|
+
echo " api-key [None]: 1234567890"
|
|
1229
|
+
echo ""
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
# qbraid credits -h
|
|
1233
|
+
help_credits() {
|
|
1234
|
+
echo ""
|
|
1235
|
+
echo "Command"
|
|
1236
|
+
echo " qbraid credits : Get number of qBraid credits remaining."
|
|
1237
|
+
echo ""
|
|
1238
|
+
echo "Optional Arguments"
|
|
1239
|
+
echo " -h, --help : Show this help message and exit."
|
|
1240
|
+
echo ""
|
|
1174
1241
|
}
|
|
1175
1242
|
|
|
1176
1243
|
#-------------------------------------------------------------------------
|
|
@@ -1186,27 +1253,37 @@ qbraid() {
|
|
|
1186
1253
|
|
|
1187
1254
|
# qbraid
|
|
1188
1255
|
elif [ -z "${1}" ]; then
|
|
1189
|
-
echo -e "
|
|
1190
|
-
echo -e "* ${PURPLE}Welcome to the qBraid CLI!${NC} *"
|
|
1191
|
-
echo -e "
|
|
1256
|
+
echo -e "---------------------------------"
|
|
1257
|
+
echo -e " * ${PURPLE}Welcome to the qBraid CLI!${NC} * "
|
|
1258
|
+
echo -e "---------------------------------"
|
|
1259
|
+
echo -e ""
|
|
1260
|
+
echo -e " ____ _ _ "
|
|
1261
|
+
echo -e " __ _| __ ) _ __ __ _(_) __| | "
|
|
1262
|
+
echo -e " / _ | _ \| __/ _ | |/ _ | "
|
|
1263
|
+
echo -e " | (_| | |_) | | | (_| | | (_| | "
|
|
1264
|
+
echo -e " \__ |____/|_| \__ _|_|\__ _| "
|
|
1265
|
+
echo -e " |_| "
|
|
1192
1266
|
echo -e ""
|
|
1193
|
-
echo -e " - Use \`qbraid -h\` to see available commands."
|
|
1194
1267
|
echo -e ""
|
|
1195
|
-
echo -e "
|
|
1268
|
+
echo -e "- Use \`qbraid -h\` to see available commands."
|
|
1269
|
+
echo -e ""
|
|
1270
|
+
echo -e "- Use \`qbraid --version\` to display the current version."
|
|
1196
1271
|
echo -e ""
|
|
1197
1272
|
echo -e "Reference Docs: https://docs.qbraid.com/projects/cli/en/latest/cli/qbraid.html"
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1273
|
+
|
|
1274
|
+
# qbraid configure
|
|
1275
|
+
elif [ "${1}" = "configure" ]; then
|
|
1276
|
+
((argDepth++))
|
|
1277
|
+
if [ "$(help_command "${argDepth}")" = "yes" ]; then
|
|
1278
|
+
help_configure
|
|
1279
|
+
fi
|
|
1280
|
+
|
|
1281
|
+
# qbraid credits
|
|
1282
|
+
elif [ "${1}" = "credits" ]; then
|
|
1283
|
+
((argDepth++))
|
|
1284
|
+
if [ "$(help_command "${argDepth}")" = "yes" ]; then
|
|
1285
|
+
help_credits
|
|
1286
|
+
fi
|
|
1210
1287
|
|
|
1211
1288
|
# qbraid envs
|
|
1212
1289
|
elif [ "${1}" = "envs" ]; then
|
|
@@ -1220,6 +1297,10 @@ qbraid() {
|
|
|
1220
1297
|
elif [ "${1}" = "jobs" ]; then
|
|
1221
1298
|
jobs "${@:2}"
|
|
1222
1299
|
|
|
1300
|
+
# qbraid devices
|
|
1301
|
+
elif [ "${1}" = "devices" ]; then
|
|
1302
|
+
devices "${@:2}"
|
|
1303
|
+
|
|
1223
1304
|
else
|
|
1224
1305
|
echo -e "${RED}ERROR: Invalid argument ${NC}${1}"
|
|
1225
1306
|
echo ""
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Module to run the qbraid command line interface.
|
|
3
3
|
|
|
4
|
+
Lazy loading is used to avoid loading the qbraid package until it is needed.
|
|
5
|
+
|
|
4
6
|
"""
|
|
5
7
|
|
|
6
8
|
import os
|
|
@@ -13,13 +15,51 @@ from .configure import configure
|
|
|
13
15
|
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
def flag_help_command():
|
|
19
|
+
"""Check if the help command should be triggered."""
|
|
20
|
+
if len(sys.argv) > 0:
|
|
21
|
+
last_arg = sys.argv[-1]
|
|
22
|
+
if last_arg in ["-h", "--help", "help"]:
|
|
23
|
+
return True
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def is_help_command(arg_index):
|
|
28
|
+
"""Check if the help command should be triggered for the given argument index"""
|
|
29
|
+
if flag_help_command() and arg_index == len(sys.argv) - 1:
|
|
30
|
+
return True
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def get_credits():
|
|
35
|
+
"""Get the number of credits available to the user."""
|
|
36
|
+
# pylint: disable-next=import-outside-toplevel
|
|
37
|
+
from qbraid.api import QbraidSession
|
|
38
|
+
|
|
39
|
+
session = QbraidSession()
|
|
40
|
+
res = session.get("/billing/credits/get-user-credits").json()
|
|
41
|
+
qbraid_credits = res["qbraidCredits"]
|
|
42
|
+
print(qbraid_credits)
|
|
43
|
+
|
|
44
|
+
|
|
16
45
|
def main():
|
|
17
46
|
"""The subprocess.run function is used to run the script and pass arguments."""
|
|
18
|
-
|
|
19
|
-
if len(sys.argv) > 1 and sys.argv[1] == "configure":
|
|
47
|
+
if len(sys.argv) == 2 and sys.argv[1] == "configure":
|
|
20
48
|
configure()
|
|
49
|
+
elif len(sys.argv) == 2 and sys.argv[1] == "credits":
|
|
50
|
+
get_credits()
|
|
21
51
|
elif sys.argv[1:] == ["--version"] or sys.argv[1:] == ["-V"]:
|
|
22
52
|
print(f"qbraid-cli/{__version__}")
|
|
53
|
+
elif len(sys.argv) == 3 and sys.argv[1:] == ["jobs", "list"]:
|
|
54
|
+
# pylint: disable-next=import-outside-toplevel
|
|
55
|
+
from qbraid import get_jobs
|
|
56
|
+
|
|
57
|
+
get_jobs()
|
|
58
|
+
elif len(sys.argv) == 3 and sys.argv[1:] == ["devices", "list"]:
|
|
59
|
+
# pylint: disable-next=import-outside-toplevel
|
|
60
|
+
from qbraid import get_devices
|
|
61
|
+
|
|
62
|
+
get_devices()
|
|
23
63
|
else:
|
|
24
64
|
result = subprocess.run(
|
|
25
65
|
[os.path.join(PROJECT_ROOT, "bin", "qbraid.sh")] + sys.argv[1:],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Command Line Interface for interacting with all parts of the qBraid platform.
|
|
5
5
|
Home-page: https://www.qbraid.com/
|
|
6
6
|
Author: qBraid Development Team
|
|
@@ -16,14 +16,15 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
23
|
Requires-Python: >= 3.8
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: qbraid>=0.5.0
|
|
26
26
|
Requires-Dist: awscli
|
|
27
|
+
Requires-Dist: ipykernel
|
|
27
28
|
Provides-Extra: dev
|
|
28
29
|
Requires-Dist: black; extra == "dev"
|
|
29
30
|
Requires-Dist: isort; extra == "dev"
|
|
@@ -48,12 +48,12 @@ setup(
|
|
|
48
48
|
packages=find_packages(),
|
|
49
49
|
include_package_data=True,
|
|
50
50
|
python_requires=">= 3.8",
|
|
51
|
-
install_requires=["awscli"],
|
|
51
|
+
install_requires=["qbraid>=0.5.0", "awscli", "ipykernel"],
|
|
52
52
|
extras_require={
|
|
53
53
|
"dev": ["black", "isort", "pylint"],
|
|
54
54
|
"docs": ["sphinx~=5.3.0", "sphinx-rtd-theme~=1.3.0", "docutils~=0.18.1"],
|
|
55
55
|
},
|
|
56
|
-
scripts=["qbraid_cli/bin/qbraid.sh"
|
|
56
|
+
scripts=["qbraid_cli/bin/qbraid.sh"],
|
|
57
57
|
entry_points={
|
|
58
58
|
"console_scripts": [
|
|
59
59
|
"qbraid=qbraid_cli.wrapper:main",
|
|
@@ -68,7 +68,6 @@ setup(
|
|
|
68
68
|
"Programming Language :: Python",
|
|
69
69
|
"Programming Language :: Python :: 3",
|
|
70
70
|
"Programming Language :: Python :: 3 :: Only",
|
|
71
|
-
"Programming Language :: Python :: 3.8",
|
|
72
71
|
"Programming Language :: Python :: 3.9",
|
|
73
72
|
"Programming Language :: Python :: 3.10",
|
|
74
73
|
"Programming Language :: Python :: 3.11",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
NC="\033[0m" # No Color
|
|
2
|
-
PURPLE="\033[0;35m"
|
|
3
|
-
|
|
4
|
-
echo -e "---------------------------------------"
|
|
5
|
-
echo -e "* ${PURPLE}Welcome to the qBraid Lab Terminal!${NC} *"
|
|
6
|
-
echo -e "---------------------------------------"
|
|
7
|
-
echo -e ""
|
|
8
|
-
echo -e " ____ _ _ "
|
|
9
|
-
echo -e " __ _| __ ) _ __ __ _(_) __| | "
|
|
10
|
-
echo -e " / _ | _ \| __/ _ | |/ _ | "
|
|
11
|
-
echo -e " | (_| | |_) | | | (_| | | (_| | "
|
|
12
|
-
echo -e " \__ |____/|_| \__ _|_|\__ _| "
|
|
13
|
-
echo -e " |_| "
|
|
14
|
-
echo -e ""
|
|
15
|
-
echo -e ""
|
|
16
|
-
echo -e "Use \`qbraid -h\` to see available CLI commands."
|
|
17
|
-
echo -e ""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|