neuronum 1.6.0__py3-none-any.whl → 1.7.0__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.
Potentially problematic release.
This version of neuronum might be problematic. Click here for more details.
- cli/main.py +280 -32
- neuronum/neuronum.py +14 -34
- {neuronum-1.6.0.dist-info → neuronum-1.7.0.dist-info}/METADATA +57 -47
- neuronum-1.7.0.dist-info/RECORD +10 -0
- neuronum-1.6.0.dist-info/RECORD +0 -10
- {neuronum-1.6.0.dist-info → neuronum-1.7.0.dist-info}/LICENSE +0 -0
- {neuronum-1.6.0.dist-info → neuronum-1.7.0.dist-info}/WHEEL +0 -0
- {neuronum-1.6.0.dist-info → neuronum-1.7.0.dist-info}/entry_points.txt +0 -0
- {neuronum-1.6.0.dist-info → neuronum-1.7.0.dist-info}/top_level.txt +0 -0
cli/main.py
CHANGED
|
@@ -13,8 +13,238 @@ def cli():
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
@click.command()
|
|
16
|
-
def
|
|
17
|
-
|
|
16
|
+
def create_cell():
|
|
17
|
+
cell_type = questionary.select(
|
|
18
|
+
"Choose Cell type:",
|
|
19
|
+
choices=["business", "community"]
|
|
20
|
+
).ask()
|
|
21
|
+
|
|
22
|
+
network = questionary.select(
|
|
23
|
+
"Choose Network:",
|
|
24
|
+
choices=["neuronum.net"]
|
|
25
|
+
).ask()
|
|
26
|
+
|
|
27
|
+
if cell_type == "business":
|
|
28
|
+
click.echo("Visit https://neuronum.net/createcell to create your Neuronum Business Cell")
|
|
29
|
+
|
|
30
|
+
if cell_type == "community":
|
|
31
|
+
|
|
32
|
+
email = click.prompt("Enter email")
|
|
33
|
+
password = click.prompt("Enter password", hide_input=True)
|
|
34
|
+
repeat_password = click.prompt("Repeat password", hide_input=True)
|
|
35
|
+
|
|
36
|
+
if password != repeat_password:
|
|
37
|
+
click.echo("Passwords do not match!")
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
url = f"https://{network}/api/create_cell/{cell_type}"
|
|
41
|
+
|
|
42
|
+
create_cell = {"email": email, "password": password}
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
response = requests.post(url, json=create_cell)
|
|
46
|
+
response.raise_for_status()
|
|
47
|
+
status = response.json()["status"]
|
|
48
|
+
|
|
49
|
+
except requests.exceptions.RequestException as e:
|
|
50
|
+
click.echo(f"Error sending request: {e}")
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
if status == True:
|
|
54
|
+
host = response.json()["host"]
|
|
55
|
+
cellkey = click.prompt(f"Please verify your email address with the Cell Key send to {email}")
|
|
56
|
+
|
|
57
|
+
url = f"https://{network}/api/verify_email"
|
|
58
|
+
|
|
59
|
+
verify_email = {"host": host, "email": email, "cellkey": cellkey}
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
response = requests.post(url, json=verify_email)
|
|
63
|
+
response.raise_for_status()
|
|
64
|
+
status = response.json()["status"]
|
|
65
|
+
|
|
66
|
+
except requests.exceptions.RequestException as e:
|
|
67
|
+
click.echo(f"Error sending request: {e}")
|
|
68
|
+
return
|
|
69
|
+
|
|
70
|
+
if status == True:
|
|
71
|
+
synapse = response.json()["synapse"]
|
|
72
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
73
|
+
credentials_folder_path.mkdir(parents=True, exist_ok=True)
|
|
74
|
+
|
|
75
|
+
env_path = credentials_folder_path / ".env"
|
|
76
|
+
env_path.write_text(f"HOST={host}\nPASSWORD={password}\nNETWORK={network}\nSYNAPSE={synapse}\n")
|
|
77
|
+
|
|
78
|
+
click.echo(f"Welcome to Neuronum! Community Cell '{host}' created and connected!")
|
|
79
|
+
|
|
80
|
+
if status == False:
|
|
81
|
+
click.echo(f"Error:'{email}' already assigned!")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@click.command()
|
|
86
|
+
def connect_cell():
|
|
87
|
+
email = click.prompt("Enter your Email")
|
|
88
|
+
password = click.prompt("Enter password", hide_input=True)
|
|
89
|
+
|
|
90
|
+
network = questionary.select(
|
|
91
|
+
"Choose Network:",
|
|
92
|
+
choices=["neuronum.net"]
|
|
93
|
+
).ask()
|
|
94
|
+
|
|
95
|
+
url = f"https://{network}/api/connect_cell"
|
|
96
|
+
payload = {"email": email, "password": password}
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
response = requests.post(url, json=payload)
|
|
100
|
+
response.raise_for_status()
|
|
101
|
+
status = response.json()["status"]
|
|
102
|
+
host = response.json()["host"]
|
|
103
|
+
except requests.exceptions.RequestException as e:
|
|
104
|
+
click.echo(f"Error connecting: {e}")
|
|
105
|
+
return
|
|
106
|
+
|
|
107
|
+
if status == True:
|
|
108
|
+
cellkey = click.prompt(f"Please verify your email address with the Cell Key send to {email}")
|
|
109
|
+
url = f"https://{network}/api/verify_email"
|
|
110
|
+
verify_email = {"host": host, "email": email, "cellkey": cellkey}
|
|
111
|
+
|
|
112
|
+
try:
|
|
113
|
+
response = requests.post(url, json=verify_email)
|
|
114
|
+
response.raise_for_status()
|
|
115
|
+
status = response.json()["status"]
|
|
116
|
+
synapse = response.json()["synapse"]
|
|
117
|
+
|
|
118
|
+
except requests.exceptions.RequestException as e:
|
|
119
|
+
click.echo(f"Error sending request: {e}")
|
|
120
|
+
return
|
|
121
|
+
|
|
122
|
+
if status == True:
|
|
123
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
124
|
+
credentials_folder_path.mkdir(parents=True, exist_ok=True)
|
|
125
|
+
|
|
126
|
+
env_path = credentials_folder_path / f".env"
|
|
127
|
+
env_path.write_text(f"HOST={host}\nPASSWORD={password}\nNETWORK={network}\nSYNAPSE={synapse}\n")
|
|
128
|
+
|
|
129
|
+
click.echo(f"Cell '{host}' connected!")
|
|
130
|
+
else:
|
|
131
|
+
click.echo(f"Connection failed!")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@click.command()
|
|
135
|
+
def view_cell():
|
|
136
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
137
|
+
env_path = credentials_folder_path / ".env"
|
|
138
|
+
|
|
139
|
+
env_data = {}
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
with open(env_path, "r") as f:
|
|
143
|
+
for line in f:
|
|
144
|
+
key, value = line.strip().split("=")
|
|
145
|
+
env_data[key] = value
|
|
146
|
+
|
|
147
|
+
host = env_data.get("HOST", "")
|
|
148
|
+
|
|
149
|
+
except FileNotFoundError:
|
|
150
|
+
click.echo("Error: No credentials found. Please connect to a cell first.")
|
|
151
|
+
return
|
|
152
|
+
except Exception as e:
|
|
153
|
+
click.echo(f"Error reading .env file: {e}")
|
|
154
|
+
return
|
|
155
|
+
|
|
156
|
+
if host:
|
|
157
|
+
click.echo(f"Connected Cell: '{host}'")
|
|
158
|
+
else:
|
|
159
|
+
click.echo("No active cell connection found.")
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@click.command()
|
|
163
|
+
def disconnect_cell():
|
|
164
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
165
|
+
env_path = credentials_folder_path / ".env"
|
|
166
|
+
|
|
167
|
+
env_data = {}
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
with open(env_path, "r") as f:
|
|
171
|
+
for line in f:
|
|
172
|
+
key, value = line.strip().split("=")
|
|
173
|
+
env_data[key] = value
|
|
174
|
+
|
|
175
|
+
host = env_data.get("HOST", "")
|
|
176
|
+
|
|
177
|
+
except FileNotFoundError:
|
|
178
|
+
click.echo("Error: .env with credentials not found")
|
|
179
|
+
return
|
|
180
|
+
except Exception as e:
|
|
181
|
+
click.echo(f"Error reading .env file: {e}")
|
|
182
|
+
return
|
|
183
|
+
|
|
184
|
+
if env_path.exists():
|
|
185
|
+
if click.confirm(f"Are you sure you want to disconnect Cell '{host}'?", default=True):
|
|
186
|
+
os.remove(env_path)
|
|
187
|
+
click.echo(f"'{host}' disconnected!")
|
|
188
|
+
else:
|
|
189
|
+
click.echo("Disconnect canceled.")
|
|
190
|
+
else:
|
|
191
|
+
click.echo(f"No Neuronum Cell connected!")
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@click.command()
|
|
195
|
+
def delete_cell():
|
|
196
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
197
|
+
env_path = credentials_folder_path / ".env"
|
|
198
|
+
|
|
199
|
+
env_data = {}
|
|
200
|
+
|
|
201
|
+
try:
|
|
202
|
+
with open(env_path, "r") as f:
|
|
203
|
+
for line in f:
|
|
204
|
+
key, value = line.strip().split("=")
|
|
205
|
+
env_data[key] = value
|
|
206
|
+
|
|
207
|
+
host = env_data.get("HOST", "")
|
|
208
|
+
password = env_data.get("PASSWORD", "")
|
|
209
|
+
network = env_data.get("NETWORK", "")
|
|
210
|
+
synapse = env_data.get("SYNAPSE", "")
|
|
211
|
+
|
|
212
|
+
except FileNotFoundError:
|
|
213
|
+
click.echo("Error: No cell connected. Connect Cell first to delete")
|
|
214
|
+
return
|
|
215
|
+
except Exception as e:
|
|
216
|
+
click.echo(f"Error reading .env file: {e}")
|
|
217
|
+
return
|
|
218
|
+
|
|
219
|
+
confirm = click.confirm(f" Are you sure you want to delete '{host}'?", default=True)
|
|
220
|
+
if not confirm:
|
|
221
|
+
click.echo("Deletion canceled.")
|
|
222
|
+
return
|
|
223
|
+
|
|
224
|
+
url = f"https://{network}/api/delete_cell"
|
|
225
|
+
payload = {"host": host, "password": password, "synapse": synapse}
|
|
226
|
+
|
|
227
|
+
try:
|
|
228
|
+
response = requests.delete(url, json=payload)
|
|
229
|
+
response.raise_for_status()
|
|
230
|
+
status = response.json()["status"]
|
|
231
|
+
except requests.exceptions.RequestException as e:
|
|
232
|
+
click.echo(f"Error deleting cell: {e}")
|
|
233
|
+
return
|
|
234
|
+
|
|
235
|
+
if status == True:
|
|
236
|
+
env_path = credentials_folder_path / f"{host}.env"
|
|
237
|
+
if env_path.exists():
|
|
238
|
+
os.remove(env_path)
|
|
239
|
+
click.echo("Credentials deleted successfully!")
|
|
240
|
+
click.echo(f"Neuronum Cell '{host}' has been deleted!")
|
|
241
|
+
else:
|
|
242
|
+
click.echo(f"Neuronum Cell '{host}' deletion failed!")
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@click.command()
|
|
246
|
+
@click.option('--sync', default=None, help="Optional stream ID to generate the sync template.")
|
|
247
|
+
def init_node(sync):
|
|
18
248
|
|
|
19
249
|
node_type = questionary.select(
|
|
20
250
|
"Choose Node type:",
|
|
@@ -22,10 +252,31 @@ def init_node():
|
|
|
22
252
|
).ask()
|
|
23
253
|
|
|
24
254
|
descr = click.prompt("Node description (max. 25 characters)")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
255
|
+
|
|
256
|
+
stream = sync if sync else "n9gW3LxQcecI::stx"
|
|
257
|
+
|
|
258
|
+
credentials_folder_path = Path.home() / ".neuronum"
|
|
259
|
+
env_path = credentials_folder_path / ".env"
|
|
260
|
+
|
|
261
|
+
env_data = {}
|
|
262
|
+
|
|
263
|
+
try:
|
|
264
|
+
with open(env_path, "r") as f:
|
|
265
|
+
for line in f:
|
|
266
|
+
key, value = line.strip().split("=")
|
|
267
|
+
env_data[key] = value
|
|
268
|
+
|
|
269
|
+
host = env_data.get("HOST", "")
|
|
270
|
+
password = env_data.get("PASSWORD", "")
|
|
271
|
+
network = env_data.get("NETWORK", "")
|
|
272
|
+
synapse = env_data.get("SYNAPSE", "")
|
|
273
|
+
|
|
274
|
+
except FileNotFoundError:
|
|
275
|
+
click.echo("No cell connected. Connect your cell with command neuronum connect-cell")
|
|
276
|
+
return
|
|
277
|
+
except Exception as e:
|
|
278
|
+
click.echo(f"Error reading .env file: {e}")
|
|
279
|
+
return
|
|
29
280
|
|
|
30
281
|
cell = neuronum.Cell(
|
|
31
282
|
host=host,
|
|
@@ -51,13 +302,16 @@ def init_node():
|
|
|
51
302
|
click.echo(f"Error sending request: {e}")
|
|
52
303
|
return
|
|
53
304
|
|
|
54
|
-
node_filename = "node"
|
|
305
|
+
node_filename = "node_" + nodeID.replace("::node", "")
|
|
55
306
|
project_path = Path(node_filename)
|
|
56
307
|
project_path.mkdir(exist_ok=True)
|
|
57
308
|
|
|
58
309
|
env_path = project_path / ".env"
|
|
59
310
|
env_path.write_text(f"NODE={nodeID}\nHOST={host}\nPASSWORD={password}\nNETWORK={network}\nSYNAPSE={synapse}\n")
|
|
60
311
|
|
|
312
|
+
gitignore_path = project_path / ".gitignore"
|
|
313
|
+
gitignore_path.write_text(f".env\n")
|
|
314
|
+
|
|
61
315
|
tx_path = project_path / "transmitters.json"
|
|
62
316
|
tx_path.write_text(json.dumps(tx, indent=4))
|
|
63
317
|
|
|
@@ -72,30 +326,29 @@ def init_node():
|
|
|
72
326
|
|
|
73
327
|
nodemd_path = project_path / "NODE.md"
|
|
74
328
|
nodemd_path.write_text("""\
|
|
75
|
-
|
|
329
|
+
## Use this NODE.md file to add instructions on how to interact with your node
|
|
76
330
|
""")
|
|
77
331
|
|
|
78
332
|
main_path = project_path / "main.py"
|
|
79
|
-
main_path.write_text("""\
|
|
333
|
+
main_path.write_text(f"""\
|
|
80
334
|
import neuronum
|
|
81
335
|
import os
|
|
82
336
|
from dotenv import load_dotenv
|
|
83
337
|
|
|
84
338
|
load_dotenv()
|
|
85
|
-
host = os.getenv("HOST")
|
|
339
|
+
host = os.getenv("HOST")
|
|
86
340
|
password = os.getenv("PASSWORD")
|
|
87
|
-
network = os.getenv("NETWORK")
|
|
88
|
-
synapse = os.getenv("SYNAPSE")
|
|
341
|
+
network = os.getenv("NETWORK")
|
|
342
|
+
synapse = os.getenv("SYNAPSE")
|
|
89
343
|
|
|
90
|
-
#set cell connection
|
|
91
344
|
cell = neuronum.Cell(
|
|
92
|
-
host=host,
|
|
93
|
-
password=password,
|
|
94
|
-
network=network,
|
|
95
|
-
synapse=synapse
|
|
345
|
+
host=host,
|
|
346
|
+
password=password,
|
|
347
|
+
network=network,
|
|
348
|
+
synapse=synapse
|
|
96
349
|
)
|
|
97
350
|
|
|
98
|
-
STX = "
|
|
351
|
+
STX = "{stream}"
|
|
99
352
|
stream = cell.sync(STX)
|
|
100
353
|
for operation in stream:
|
|
101
354
|
label = operation.get("label")
|
|
@@ -104,7 +357,7 @@ for operation in stream:
|
|
|
104
357
|
stxID = operation.get("stxID")
|
|
105
358
|
operator = operation.get("operator")
|
|
106
359
|
print(label, value, ts, stxID, operator)
|
|
107
|
-
|
|
360
|
+
""")
|
|
108
361
|
|
|
109
362
|
click.echo(f"Neuronum Node '{nodeID}' initialized!")
|
|
110
363
|
|
|
@@ -125,20 +378,19 @@ def start_node():
|
|
|
125
378
|
with open("node_pid.txt", "w") as f:
|
|
126
379
|
f.write(str(process.pid))
|
|
127
380
|
|
|
128
|
-
click.echo("
|
|
381
|
+
click.echo("Node started successfully!")
|
|
129
382
|
|
|
130
383
|
|
|
131
384
|
@click.command()
|
|
132
385
|
def stop_node():
|
|
133
|
-
"
|
|
134
|
-
click.echo("Stopping Neuronum Node...")
|
|
386
|
+
click.echo("Stopping Node...")
|
|
135
387
|
|
|
136
388
|
try:
|
|
137
389
|
with open("node_pid.txt", "r") as f:
|
|
138
390
|
pid = int(f.read().strip())
|
|
139
391
|
os.kill(pid, 9)
|
|
140
392
|
os.remove("node_pid.txt")
|
|
141
|
-
click.echo("
|
|
393
|
+
click.echo("Node stopped successfully!")
|
|
142
394
|
except FileNotFoundError:
|
|
143
395
|
click.echo("Error: No active node process found.")
|
|
144
396
|
except Exception as e:
|
|
@@ -147,10 +399,7 @@ def stop_node():
|
|
|
147
399
|
|
|
148
400
|
@click.command()
|
|
149
401
|
def register_node():
|
|
150
|
-
click.echo("Register Node")
|
|
151
|
-
|
|
152
402
|
env_data = {}
|
|
153
|
-
|
|
154
403
|
try:
|
|
155
404
|
with open(".env", "r") as f:
|
|
156
405
|
for line in f:
|
|
@@ -205,10 +454,7 @@ def register_node():
|
|
|
205
454
|
|
|
206
455
|
@click.command()
|
|
207
456
|
def update_node():
|
|
208
|
-
click.echo("Update Node")
|
|
209
|
-
|
|
210
457
|
env_data = {}
|
|
211
|
-
|
|
212
458
|
try:
|
|
213
459
|
with open(".env", "r") as f:
|
|
214
460
|
for line in f:
|
|
@@ -286,10 +532,7 @@ def update_node():
|
|
|
286
532
|
|
|
287
533
|
@click.command()
|
|
288
534
|
def delete_node():
|
|
289
|
-
click.echo("Delete Node")
|
|
290
|
-
|
|
291
535
|
env_data = {}
|
|
292
|
-
|
|
293
536
|
try:
|
|
294
537
|
with open(".env", "r") as f:
|
|
295
538
|
for line in f:
|
|
@@ -329,6 +572,11 @@ def delete_node():
|
|
|
329
572
|
click.echo(f"Neuronum Node '{nodeID}' deleted!")
|
|
330
573
|
|
|
331
574
|
|
|
575
|
+
cli.add_command(create_cell)
|
|
576
|
+
cli.add_command(connect_cell)
|
|
577
|
+
cli.add_command(view_cell)
|
|
578
|
+
cli.add_command(disconnect_cell)
|
|
579
|
+
cli.add_command(delete_cell)
|
|
332
580
|
cli.add_command(init_node)
|
|
333
581
|
cli.add_command(start_node)
|
|
334
582
|
cli.add_command(stop_node)
|
neuronum/neuronum.py
CHANGED
|
@@ -256,23 +256,6 @@ class Cell:
|
|
|
256
256
|
except Exception as e:
|
|
257
257
|
print(f"Unexpected error: {e}")
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
def connect(self):
|
|
261
|
-
url = f"https://{self.network}/api/connect"
|
|
262
|
-
|
|
263
|
-
test = {
|
|
264
|
-
"cell": self.to_dict()
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
try:
|
|
268
|
-
response = requests.post(url, json=test)
|
|
269
|
-
response.raise_for_status()
|
|
270
|
-
print(response.json()["connection"])
|
|
271
|
-
except requests.exceptions.RequestException as e:
|
|
272
|
-
print(f"Error sending request: {e}")
|
|
273
|
-
except Exception as e:
|
|
274
|
-
print(f"Unexpected error: {e}")
|
|
275
|
-
|
|
276
259
|
|
|
277
260
|
def store(self, label: str, data: dict, ctx: Optional[str] = None):
|
|
278
261
|
if ctx:
|
|
@@ -429,21 +412,21 @@ class Cell:
|
|
|
429
412
|
|
|
430
413
|
|
|
431
414
|
def sign_contract(self, contractID: str):
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
415
|
+
full_url = f"https://{self.network}/api/sign_contract"
|
|
416
|
+
|
|
417
|
+
sign_contract = {
|
|
418
|
+
"contractID": contractID,
|
|
419
|
+
"cell": self.to_dict()
|
|
420
|
+
}
|
|
438
421
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
422
|
+
try:
|
|
423
|
+
response = requests.post(full_url, json=sign_contract)
|
|
424
|
+
response.raise_for_status()
|
|
425
|
+
return response.json()["token"]
|
|
426
|
+
except requests.exceptions.RequestException as e:
|
|
427
|
+
print(f"Error sending request: {e}")
|
|
428
|
+
except Exception as e:
|
|
429
|
+
print(f"Unexpected error: {e}")
|
|
447
430
|
|
|
448
431
|
|
|
449
432
|
def validate_token(self, token: str, cp: str, contractID: str):
|
|
@@ -559,7 +542,4 @@ class Cell:
|
|
|
559
542
|
print(f"Unexpected error: {e}")
|
|
560
543
|
|
|
561
544
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
545
|
__all__ = ['Cell']
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: neuronum
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.7.0
|
|
4
|
+
Summary: Official client library to interact with the Neuronum Network
|
|
5
5
|
Home-page: https://neuronum.net
|
|
6
6
|
Author: Neuronum Cybernetics
|
|
7
7
|
Author-email: welcome@neuronum.net
|
|
@@ -9,7 +9,7 @@ Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: requests
|
|
@@ -22,75 +22,85 @@ Requires-Dist: python-dotenv
|
|
|
22
22
|
|
|
23
23
|
[](https://neuronum.net) [](https://github.com/neuronumcybernetics/neuronum)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Build, deploy and automate IoT connectivity with `Neuronum`
|
|
26
26
|
|
|
27
27
|
## Features
|
|
28
|
-
- **Cell**:
|
|
29
|
-
- **Nodes/Node-CLI**: Setup and manage Neuronum Nodes from the command line
|
|
28
|
+
- **Cells/Cell-CLI**: Create and manage Neuronum Cells from the command line
|
|
29
|
+
- **Nodes/Node-CLI**: Setup and manage Neuronum Nodes from the command line
|
|
30
30
|
- **Transmitters (TX)**: Automate economic data transfer
|
|
31
31
|
- **Circuits (CTX)**: Store data in Key-Value-Label databases
|
|
32
32
|
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
33
|
-
- **Contracts/Tokens**: Automate
|
|
34
|
-
|
|
33
|
+
- **Contracts/Tokens**: Automate services exchange and authorization between Cells and Nodes
|
|
35
34
|
|
|
36
35
|
### Installation
|
|
37
36
|
Install the Neuronum library using pip:
|
|
38
|
-
```
|
|
39
|
-
pip install neuronum
|
|
37
|
+
```sh
|
|
38
|
+
$ pip install neuronum
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
### Cell
|
|
43
|
-
To interact with the Network you
|
|
44
|
-
Create your Cell: [Create Cell](https://neuronum.net/createcell)
|
|
41
|
+
### Cells/Cell-CLI
|
|
42
|
+
To interact with the Neuronum Network, you must first create a Neuronum Cell
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
|
|
44
|
+
Create Cell:
|
|
45
|
+
```sh
|
|
46
|
+
$ neuronum create-cell
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Connect Cell:
|
|
50
|
+
```sh
|
|
51
|
+
$ neuronum connect-cell
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
View connected Cell:
|
|
55
|
+
```sh
|
|
56
|
+
$ neuronum view-cell
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Disconnect Cell:
|
|
60
|
+
```sh
|
|
61
|
+
$ neuronum disconnect-cell
|
|
62
|
+
```
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
network="neuronum.net", # cell network
|
|
54
|
-
synapse="your_synapse" # cell synapse
|
|
55
|
-
)
|
|
56
|
-
cell.connect() # connect to network
|
|
64
|
+
Delete Cell:
|
|
65
|
+
```sh
|
|
66
|
+
$ neuronum delete-cell
|
|
57
67
|
```
|
|
58
68
|
|
|
59
69
|
### Nodes/Node-CLI
|
|
60
|
-
Neuronum Nodes are
|
|
70
|
+
Neuronum Nodes are soft- and hardware components that power the Neuronum Network, enabling seamless communication between Nodes and Cells
|
|
61
71
|
|
|
62
|
-
Initialize
|
|
63
|
-
```
|
|
64
|
-
|
|
72
|
+
Initialize a Node:
|
|
73
|
+
```sh
|
|
74
|
+
$ neuronum init-node # neuronum init-node --sync id::stx (optional)
|
|
65
75
|
```
|
|
66
76
|
|
|
67
|
-
Start
|
|
68
|
-
```
|
|
69
|
-
|
|
77
|
+
Start a Node:
|
|
78
|
+
```sh
|
|
79
|
+
$ neuronum start-node
|
|
70
80
|
```
|
|
71
81
|
|
|
72
|
-
Stop
|
|
73
|
-
```
|
|
74
|
-
|
|
82
|
+
Stop a Node:
|
|
83
|
+
```sh
|
|
84
|
+
$ neuronum stop-node
|
|
75
85
|
```
|
|
76
86
|
|
|
77
|
-
Register
|
|
78
|
-
```
|
|
79
|
-
|
|
87
|
+
Register a Node on the Neuronum Network:
|
|
88
|
+
```sh
|
|
89
|
+
$ neuronum register-node
|
|
80
90
|
```
|
|
81
91
|
|
|
82
|
-
Update
|
|
83
|
-
```
|
|
84
|
-
|
|
92
|
+
Update a Node:
|
|
93
|
+
```sh
|
|
94
|
+
$ neuronum update-node
|
|
85
95
|
```
|
|
86
96
|
|
|
87
|
-
Delete
|
|
88
|
-
```
|
|
89
|
-
|
|
97
|
+
Delete a Node:
|
|
98
|
+
```sh
|
|
99
|
+
$ neuronum delete-node
|
|
90
100
|
```
|
|
91
101
|
|
|
92
102
|
### Transmitters (TX)
|
|
93
|
-
Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format
|
|
103
|
+
Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format
|
|
94
104
|
|
|
95
105
|
Create Transmitter (TX):
|
|
96
106
|
```python
|
|
@@ -283,15 +293,15 @@ stxList = cell.list_stx() # list Streams
|
|
|
283
293
|
```
|
|
284
294
|
|
|
285
295
|
### Contracts/Tokens
|
|
286
|
-
Contracts
|
|
296
|
+
Contracts are predefined token-based rules to automate service exchange and authorization between Cells and Nodes
|
|
287
297
|
|
|
288
298
|
Create a Contract:
|
|
289
299
|
```python
|
|
290
300
|
descr = "Test Contract" # short description (max 25 characters)
|
|
291
301
|
details = { # define token details
|
|
292
|
-
"price_in_eur":
|
|
293
|
-
"max_usage":
|
|
294
|
-
"validity_in_min":
|
|
302
|
+
"price_in_eur": False, # token price in EUR (int, float or False)
|
|
303
|
+
"max_usage": False, # max number of uses (int or False)
|
|
304
|
+
"validity_in_min": False # token expiration time in min (int, float or False)
|
|
295
305
|
}
|
|
296
306
|
partners = ["id::cell", "id::cell"]
|
|
297
307
|
contractID = cell.create_contract(descr, details, partners)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
cli/main.py,sha256=w4pNMA7ySCKTk4Z-Mb3W7cIw5ZUpLrP92L2HfrcFxSM,17637
|
|
3
|
+
neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
|
|
4
|
+
neuronum/neuronum.py,sha256=4j3fV7VHPb1KcQucOEDBQ-v2SoG9c2WfGPqMfI3OF88,16498
|
|
5
|
+
neuronum-1.7.0.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
|
|
6
|
+
neuronum-1.7.0.dist-info/METADATA,sha256=GqgpO0lCzLKJwOfNRH8GzXPbRgsvRvZm3YP5FPVMbNs,12806
|
|
7
|
+
neuronum-1.7.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
8
|
+
neuronum-1.7.0.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
|
|
9
|
+
neuronum-1.7.0.dist-info/top_level.txt,sha256=ru8Fr84cHm6oHr_DcJ8-uaq3RTiuCRFIr6AC8V0zPu4,13
|
|
10
|
+
neuronum-1.7.0.dist-info/RECORD,,
|
neuronum-1.6.0.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
cli/main.py,sha256=wD5wj2qy-VKwrx9CWoHbxmERSO1Z11B59oMJc49GM9E,9449
|
|
3
|
-
neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
|
|
4
|
-
neuronum/neuronum.py,sha256=qJqYpVoKdUw0YOa7aMp85QSOflkn8R7sqF5dIlTkBe0,16993
|
|
5
|
-
neuronum-1.6.0.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
|
|
6
|
-
neuronum-1.6.0.dist-info/METADATA,sha256=BblXzU3CeyyrTzdEyj0K--RnillyBYhNi-61mao50HA,13089
|
|
7
|
-
neuronum-1.6.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
8
|
-
neuronum-1.6.0.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
|
|
9
|
-
neuronum-1.6.0.dist-info/top_level.txt,sha256=ru8Fr84cHm6oHr_DcJ8-uaq3RTiuCRFIr6AC8V0zPu4,13
|
|
10
|
-
neuronum-1.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|