naeural-client 2.3.1__py3-none-any.whl → 2.3.3__py3-none-any.whl
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.
- naeural_client/_ver.py +1 -1
- naeural_client/cli/cli.py +57 -15
- naeural_client/cli/cli_commands.py +33 -6
- naeural_client/cli/nodes.py +34 -3
- naeural_client/const/misc.py +1 -1
- naeural_client/const/payload.py +3 -0
- naeural_client/logging/base_logger.py +2 -0
- naeural_client/utils/config.py +4 -3
- {naeural_client-2.3.1.dist-info → naeural_client-2.3.3.dist-info}/METADATA +1 -1
- {naeural_client-2.3.1.dist-info → naeural_client-2.3.3.dist-info}/RECORD +13 -13
- {naeural_client-2.3.1.dist-info → naeural_client-2.3.3.dist-info}/WHEEL +0 -0
- {naeural_client-2.3.1.dist-info → naeural_client-2.3.3.dist-info}/entry_points.txt +0 -0
- {naeural_client-2.3.1.dist-info → naeural_client-2.3.3.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
naeural_client/cli/cli.py
CHANGED
@@ -15,34 +15,76 @@ def build_parser():
|
|
15
15
|
Configured argument parser.
|
16
16
|
"""
|
17
17
|
descr = f"nepctl v{version} - CLI for Naeural Edge Protocol SDK package"
|
18
|
-
|
19
|
-
|
20
18
|
parser = argparse.ArgumentParser(description=descr)
|
21
19
|
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
22
20
|
|
23
|
-
# Iterate over top-level commands
|
24
21
|
for command, subcommands in CLI_COMMANDS.items():
|
25
22
|
command_parser = subparsers.add_parser(command, help=f"{command} commands")
|
26
|
-
|
23
|
+
|
24
|
+
if isinstance(subcommands, dict) and "func" not in subcommands:
|
25
|
+
# Nested subcommands
|
27
26
|
command_subparsers = command_parser.add_subparsers(dest="subcommand")
|
28
|
-
for subcommand,
|
27
|
+
for subcommand, subcmd_info in subcommands.items():
|
29
28
|
subcommand_parser = command_subparsers.add_parser(
|
30
|
-
|
29
|
+
subcommand, help=f"{subcommand} command"
|
31
30
|
)
|
32
|
-
|
31
|
+
if isinstance(subcmd_info, dict) and "params" in subcmd_info:
|
32
|
+
for param, description in subcmd_info["params"].items():
|
33
|
+
if param.startswith("--"):
|
34
|
+
subcommand_parser.add_argument(
|
35
|
+
param, action="store_true", help=description
|
36
|
+
)
|
37
|
+
else:
|
38
|
+
subcommand_parser.add_argument(
|
39
|
+
param, help=description
|
40
|
+
)
|
41
|
+
#end if
|
42
|
+
#end for
|
43
|
+
#end if
|
44
|
+
subcommand_parser.set_defaults(func=subcmd_info["func"])
|
33
45
|
else:
|
34
|
-
|
46
|
+
# Single-level commands with parameters
|
47
|
+
if "params" in subcommands:
|
48
|
+
for param, description in subcommands["params"].items():
|
49
|
+
if param.startswith("--"):
|
50
|
+
command_parser.add_argument(
|
51
|
+
param, action="store_true", help=description
|
52
|
+
)
|
53
|
+
else:
|
54
|
+
command_parser.add_argument(
|
55
|
+
param, help=description
|
56
|
+
)
|
57
|
+
#end if
|
58
|
+
command_parser.set_defaults(func=subcommands["func"])
|
35
59
|
|
36
60
|
return parser
|
37
61
|
|
62
|
+
|
63
|
+
|
38
64
|
def main():
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
65
|
+
"""
|
66
|
+
Main entry point for the CLI.
|
67
|
+
Ensures the configuration is initialized, builds the parser,
|
68
|
+
and executes the appropriate command function.
|
69
|
+
"""
|
70
|
+
try:
|
71
|
+
# Initialize configuration if necessary
|
72
|
+
maybe_init_config()
|
73
|
+
|
74
|
+
# Build the CLI parser
|
75
|
+
parser = build_parser()
|
76
|
+
args = parser.parse_args()
|
77
|
+
|
78
|
+
# Check if a command function is provided
|
79
|
+
if hasattr(args, "func"):
|
80
|
+
args.func(args) # Pass parsed arguments to the command function
|
81
|
+
else:
|
82
|
+
parser.print_help()
|
83
|
+
|
84
|
+
except Exception as e:
|
85
|
+
# Handle unexpected errors gracefully
|
86
|
+
print(f"Error: {e}")
|
87
|
+
|
46
88
|
|
47
89
|
if __name__ == "__main__":
|
48
90
|
main()
|
@@ -1,15 +1,42 @@
|
|
1
|
-
from naeural_client.cli.nodes import
|
1
|
+
from naeural_client.cli.nodes import (
|
2
|
+
get_nodes, get_supervisors,
|
3
|
+
restart_node, shutdown_node
|
4
|
+
)
|
2
5
|
from naeural_client.utils.config import show_config, reset_config
|
3
6
|
|
4
7
|
|
5
8
|
# Define the available commands
|
6
9
|
CLI_COMMANDS = {
|
7
10
|
"get": {
|
8
|
-
"nodes":
|
9
|
-
|
11
|
+
"nodes": {
|
12
|
+
"func": get_nodes,
|
13
|
+
"params": {
|
14
|
+
"--all": "Get all nodes",
|
15
|
+
"--peered": "Get only peered nodes"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"supervisors": {
|
19
|
+
"func": get_supervisors,
|
20
|
+
},
|
10
21
|
},
|
11
22
|
"config": {
|
12
|
-
"show":
|
13
|
-
|
23
|
+
"show": {
|
24
|
+
"func": show_config,
|
25
|
+
},
|
26
|
+
"reset": {
|
27
|
+
"func": reset_config,
|
28
|
+
},
|
14
29
|
},
|
15
|
-
|
30
|
+
"restart": {
|
31
|
+
"func": restart_node,
|
32
|
+
"params": {
|
33
|
+
"node": "The node to restart"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"shutdown": {
|
37
|
+
"func": shutdown_node,
|
38
|
+
"params": {
|
39
|
+
"node": "The node to shutdown"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
naeural_client/cli/nodes.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from naeural_client.utils.config import log_with_color
|
2
2
|
|
3
3
|
|
4
|
-
def get_nodes():
|
4
|
+
def get_nodes(args):
|
5
5
|
"""
|
6
6
|
This function is used to get the information about the nodes and it will perform the following:
|
7
7
|
|
@@ -10,13 +10,44 @@ def get_nodes():
|
|
10
10
|
3. Wait for the second net mon message via Session and show progress.
|
11
11
|
4. Get the active nodes union via Session and display the nodes marking those peered vs non-peered.
|
12
12
|
"""
|
13
|
-
|
13
|
+
if args.all:
|
14
|
+
log_with_color("Getting all nodes information", color="b")
|
15
|
+
elif args.peered:
|
16
|
+
log_with_color("Getting peered nodes information", color="b")
|
17
|
+
else:
|
18
|
+
log_with_color("Getting default nodes information", color="b")
|
14
19
|
return
|
15
20
|
|
16
21
|
|
17
|
-
def get_supervisors():
|
22
|
+
def get_supervisors(args):
|
18
23
|
"""
|
19
24
|
This function is used to get the information about the supervisors.
|
20
25
|
"""
|
21
26
|
log_with_color("Getting supervisors information", color='b')
|
27
|
+
return
|
28
|
+
|
29
|
+
|
30
|
+
def restart_node(args):
|
31
|
+
"""
|
32
|
+
This function is used to restart the node.
|
33
|
+
|
34
|
+
Parameters
|
35
|
+
----------
|
36
|
+
args : argparse.Namespace
|
37
|
+
Arguments passed to the function.
|
38
|
+
"""
|
39
|
+
log_with_color(f"Restarting node {args.node}", color='b')
|
40
|
+
return
|
41
|
+
|
42
|
+
|
43
|
+
def shutdown_node(args):
|
44
|
+
"""
|
45
|
+
This function is used to shutdown the node.
|
46
|
+
|
47
|
+
Parameters
|
48
|
+
----------
|
49
|
+
args : argparse.Namespace
|
50
|
+
Arguments passed to the function.
|
51
|
+
"""
|
52
|
+
log_with_color(f"Shutting down node {args.node}", color='b')
|
22
53
|
return
|
naeural_client/const/misc.py
CHANGED
naeural_client/const/payload.py
CHANGED
naeural_client/utils/config.py
CHANGED
@@ -31,8 +31,9 @@ def log_with_color(s, color='n'):
|
|
31
31
|
'r': '\033[31m', # Red
|
32
32
|
'g': '\033[32m', # Green
|
33
33
|
'y': '\033[33m', # Yellow
|
34
|
-
'b':
|
34
|
+
'b': "\x1b[1;34m", # bright blue
|
35
35
|
'w': '\033[97m', # Light white
|
36
|
+
'c': "\x1b[1;36m", # bright cyan
|
36
37
|
'n': '\033[37m', # Dark white (default)
|
37
38
|
}
|
38
39
|
|
@@ -53,7 +54,7 @@ def get_user_config_file():
|
|
53
54
|
"""
|
54
55
|
return get_user_folder() / "config"
|
55
56
|
|
56
|
-
def reset_config():
|
57
|
+
def reset_config(args):
|
57
58
|
"""
|
58
59
|
Resets the configuration by creating a ~/.naeural folder and populating
|
59
60
|
~/.naeural/config with values from a local .env file, if it exists.
|
@@ -78,7 +79,7 @@ def reset_config():
|
|
78
79
|
log_with_color(f"Configuration has been reset to default in {config_file}:\n{ENV_TEMPLATE}", color='y')
|
79
80
|
|
80
81
|
|
81
|
-
def show_config():
|
82
|
+
def show_config(args):
|
82
83
|
"""
|
83
84
|
Displays the current configuration from ~/.naeural/config.
|
84
85
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.3.
|
3
|
+
Version: 2.3.3
|
4
4
|
Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
|
5
5
|
Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
|
6
6
|
Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
|
@@ -1,5 +1,5 @@
|
|
1
1
|
naeural_client/__init__.py,sha256=UKEDGS0wFYyxwmhEAKJGecO2vYbIfRYUP4SQgnK10IE,578
|
2
|
-
naeural_client/_ver.py,sha256=
|
2
|
+
naeural_client/_ver.py,sha256=GQ_36ciIRKCRNG8bJxPw3rbxI1SLK92UEEFnv7b2rwg,330
|
3
3
|
naeural_client/base_decentra_object.py,sha256=wXjl65gWxxkhV6Tq48wFfNGITvdYdkKPT-wLurGB5vc,4287
|
4
4
|
naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
5
5
|
naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
@@ -19,9 +19,9 @@ naeural_client/bc/ec.py,sha256=raIGI7BpSH8xU_Bg7RpKv9KEW3F6PuAdL5miZfvw7iI,14027
|
|
19
19
|
naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
21
21
|
naeural_client/cli/README.md,sha256=WPdI_EjzAbUW1aPyj1sSR8rLydcJKZtoiaEtklQrjHo,74
|
22
|
-
naeural_client/cli/cli.py,sha256=
|
23
|
-
naeural_client/cli/cli_commands.py,sha256=
|
24
|
-
naeural_client/cli/nodes.py,sha256=
|
22
|
+
naeural_client/cli/cli.py,sha256=puxQ_5acL6tD2YOt8PdO5idiuKT2VUt7YzMigO3IY50,2752
|
23
|
+
naeural_client/cli/cli_commands.py,sha256=Sm7_Ig3jxs0P7S9X_vsTrv4jthWfzo9Meb05ufI4pxQ,911
|
24
|
+
naeural_client/cli/nodes.py,sha256=0aS9d26DtzEJHcNHiprBxlPPOdEX7B1DXDFyzL9mXVU,1406
|
25
25
|
naeural_client/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
|
26
26
|
naeural_client/code_cheker/base.py,sha256=lT5DRIFO5rqzsMNCmdMRfkAeevmezozehyfgmhnKpuI,19074
|
27
27
|
naeural_client/code_cheker/checker.py,sha256=QWupeM7ToancVIq1tRUxRNUrI8B5l5eoY0kDU4-O5aE,7365
|
@@ -36,8 +36,8 @@ naeural_client/const/comms.py,sha256=La6JXWHexH8CfcBCKyT4fCIoeaoZlcm7KtZ57ab4ZgU
|
|
36
36
|
naeural_client/const/environment.py,sha256=iytmTDgbOjvORPwHQmc0K0r-xJx7dnnzNnqAJJiFCDA,870
|
37
37
|
naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
38
38
|
naeural_client/const/heartbeat.py,sha256=jGHmKfeHTFOXJaKUT3o_ocnQyF-EpcLeunW-ifkYKfU,2534
|
39
|
-
naeural_client/const/misc.py,sha256=
|
40
|
-
naeural_client/const/payload.py,sha256=
|
39
|
+
naeural_client/const/misc.py,sha256=Y6x00YDtY1_nAk4OvikCLlfp8ggn11WQYTBGYzFlJPk,211
|
40
|
+
naeural_client/const/payload.py,sha256=vxTM2qilqHpfjLATfUX_Oi-hjJxyL3tirnvitYw_ejY,5828
|
41
41
|
naeural_client/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
42
42
|
naeural_client/default/instance/__init__.py,sha256=Itb4l6_DR6CCw8KAxyQKlCmALyzDasNHIfM9VB-Umak,548
|
43
43
|
naeural_client/default/instance/chain_dist_custom_job_01_plugin.py,sha256=QtHi3uXKsVs9eyMgbnvBVbMylErhV1Du4X2-7zDL7Y0,1915
|
@@ -56,7 +56,7 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
|
|
56
56
|
naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
|
57
57
|
naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
|
58
58
|
naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
|
59
|
-
naeural_client/logging/base_logger.py,sha256=
|
59
|
+
naeural_client/logging/base_logger.py,sha256=uyR4rxXQGd9UrdIdRRhS6T7UmnzyEfFooVXikxOsfw4,65951
|
60
60
|
naeural_client/logging/small_logger.py,sha256=m12hCb_H4XifJYYfgCAOUDkcXm-h4pSODnFf277OFVI,2937
|
61
61
|
naeural_client/logging/logger_mixins/__init__.py,sha256=yQO7umlRvz63FeWpi-F9GRmC_MOHcNW6R6pwvZZBy3A,600
|
62
62
|
naeural_client/logging/logger_mixins/class_instance_mixin.py,sha256=xUXE2VZgmrlrSrvw0f6GF1jlTnVLeVkIiG0bhlBfq3o,2741
|
@@ -78,10 +78,10 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
|
|
78
78
|
naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
|
79
79
|
naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
|
80
80
|
naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
|
81
|
-
naeural_client/utils/config.py,sha256=
|
81
|
+
naeural_client/utils/config.py,sha256=t_VzyBnRHJa-Kt71HUu9gXxeDOri1Aqf_-gjO04gAYs,3681
|
82
82
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
83
|
-
naeural_client-2.3.
|
84
|
-
naeural_client-2.3.
|
85
|
-
naeural_client-2.3.
|
86
|
-
naeural_client-2.3.
|
87
|
-
naeural_client-2.3.
|
83
|
+
naeural_client-2.3.3.dist-info/METADATA,sha256=K-DHydXlyDgYHKBW_lYVnGV3ZG0xqoePu216HbcdsPY,14449
|
84
|
+
naeural_client-2.3.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
85
|
+
naeural_client-2.3.3.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
|
86
|
+
naeural_client-2.3.3.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
87
|
+
naeural_client-2.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|