neuronum 2.0.6__tar.gz → 2.0.8__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 neuronum might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuronum
3
- Version: 2.0.6
3
+ Version: 2.0.8
4
4
  Summary: Official client library to interact with the Neuronum Network
5
5
  Home-page: https://neuronum.net
6
6
  Author: Neuronum Cybernetics
@@ -35,8 +35,8 @@ Dynamic: summary
35
35
 
36
36
  Build, deploy and automate serverless data infrastructures for an interconnected world with `Neuronum`
37
37
 
38
- ### **What's New in neuronum==2.0.6?**
39
- - **Nodes/Node-CLI**: Improved logic: `neuronum init-node` now supports multiple --stream and --sync flags for better flexibility
38
+ ### **What's New in neuronum==2.0.8?**
39
+ - **Nodes/Node-CLI**: Improved default template for `neuronum init-node`
40
40
 
41
41
  ### New Feature Set
42
42
  - **Cells/Cell-CLI**: Create and manage Neuronum Cells from the command line
@@ -44,7 +44,7 @@ Build, deploy and automate serverless data infrastructures for an interconnected
44
44
  - **Transmitters (TX)**: Automate economic data transfer
45
45
  - **Circuits (CTX)**: Store data in Key-Value-Label databases
46
46
  - **Streams (STX)**: Stream, synchronize and control data in real time
47
- - **Contracts/Tokens**: Automate services exchange and authorization between Cells and Nodes
47
+ - **Contracts/Tokens**: Automate service exchange and authorization between Cells and Nodes
48
48
  - **Cellai**: A local running task assistant in development (version 0.0.1)
49
49
 
50
50
  ### Installation
@@ -4,8 +4,8 @@
4
4
 
5
5
  Build, deploy and automate serverless data infrastructures for an interconnected world with `Neuronum`
6
6
 
7
- ### **What's New in neuronum==2.0.6?**
8
- - **Nodes/Node-CLI**: Improved logic: `neuronum init-node` now supports multiple --stream and --sync flags for better flexibility
7
+ ### **What's New in neuronum==2.0.8?**
8
+ - **Nodes/Node-CLI**: Improved default template for `neuronum init-node`
9
9
 
10
10
  ### New Feature Set
11
11
  - **Cells/Cell-CLI**: Create and manage Neuronum Cells from the command line
@@ -13,7 +13,7 @@ Build, deploy and automate serverless data infrastructures for an interconnected
13
13
  - **Transmitters (TX)**: Automate economic data transfer
14
14
  - **Circuits (CTX)**: Store data in Key-Value-Label databases
15
15
  - **Streams (STX)**: Stream, synchronize and control data in real time
16
- - **Contracts/Tokens**: Automate services exchange and authorization between Cells and Nodes
16
+ - **Contracts/Tokens**: Automate service exchange and authorization between Cells and Nodes
17
17
  - **Cellai**: A local running task assistant in development (version 0.0.1)
18
18
 
19
19
  ### Installation
@@ -249,13 +249,6 @@ def delete_cell():
249
249
  @click.option('--stream', multiple=True, default=None, help="Optional stream ID for stream.")
250
250
  def init_node(sync, stream):
251
251
 
252
- node_type = questionary.select(
253
- "Choose Node type:",
254
- choices=["public", "private"]
255
- ).ask()
256
-
257
- descr = click.prompt("Node description (max. 25 characters)")
258
-
259
252
  credentials_folder_path = Path.home() / ".neuronum"
260
253
  env_path = credentials_folder_path / ".env"
261
254
 
@@ -279,8 +272,8 @@ def init_node(sync, stream):
279
272
  click.echo(f"Error reading .env file: {e}")
280
273
  return
281
274
 
282
- url = f"https://{network}/api/init_node/{node_type}"
283
- node = {"descr": descr, "host": host, "password": password, "synapse": synapse}
275
+ url = f"https://{network}/api/init_node"
276
+ node = {"host": host, "password": password, "synapse": synapse}
284
277
 
285
278
  try:
286
279
  response = requests.post(url, json=node)
@@ -331,7 +324,7 @@ def init_node(sync, stream):
331
324
  nodemd_path = project_path / "NODE.md"
332
325
  nodemd_path.write_text("## Use this NODE.md file to add instructions on how to interact with your node\n")
333
326
 
334
- stx = sync[0] if sync else (stream[0] if stream else "n9gW3LxQcecI::stx")
327
+ stx = sync[0] if sync else (stream[0] if stream else host.replace("::cell", "::stx"))
335
328
 
336
329
  if sync:
337
330
  for stx in sync:
@@ -399,8 +392,8 @@ while True:
399
392
  """)
400
393
 
401
394
  if not sync and not stream:
402
- main_path = project_path / "main.py"
403
- main_path.write_text(f"""\
395
+ sync_path = project_path / f"sync_{stx.replace('::stx', '')}.py"
396
+ sync_path.write_text(f"""\
404
397
  import neuronum
405
398
  import os
406
399
  from dotenv import load_dotenv
@@ -421,12 +414,36 @@ cell = neuronum.Cell(
421
414
  STX = "{stx}"
422
415
  stream = cell.sync(STX)
423
416
  for operation in stream:
424
- label = operation.get("label")
425
417
  message = operation.get("data").get("message")
426
- ts = operation.get("time")
427
- stxID = operation.get("stxID")
428
- operator = operation.get("operator")
429
- print(label, message, ts, stxID, operator)
418
+ print(message)
419
+ """)
420
+
421
+ stream_path = project_path / f"stream_{stx.replace('::stx', '')}.py"
422
+ stream_path.write_text(f"""\
423
+ import neuronum
424
+ import os
425
+ from dotenv import load_dotenv
426
+
427
+ load_dotenv()
428
+ host = os.getenv("HOST")
429
+ password = os.getenv("PASSWORD")
430
+ network = os.getenv("NETWORK")
431
+ synapse = os.getenv("SYNAPSE")
432
+
433
+ cell = neuronum.Cell(
434
+ host=host,
435
+ password=password,
436
+ network=network,
437
+ synapse=synapse
438
+ )
439
+
440
+ STX = "{stx}"
441
+ label = "Welcome to Neuronum"
442
+ while True:
443
+ data = {{
444
+ "message": "Hello, Neuronum!"
445
+ }}
446
+ cell.stream(label, data, STX)
430
447
  """)
431
448
 
432
449
  click.echo(f"Neuronum Node '{nodeID}' initialized!")
@@ -439,7 +456,7 @@ def start_node():
439
456
 
440
457
  project_path = Path.cwd()
441
458
 
442
- script_files = ["main.py"] + glob.glob("sync_*.py") + glob.glob("stream_*.py")
459
+ script_files = glob.glob("sync_*.py") + glob.glob("stream_*.py")
443
460
 
444
461
  processes = []
445
462
 
@@ -456,8 +473,7 @@ def start_node():
456
473
  with open("node_pid.txt", "w") as f:
457
474
  f.write("\n".join(map(str, processes)))
458
475
 
459
- click.echo(f"Node started successfully! Running {len(processes)} scripts: {', '.join(script_files)}")
460
-
476
+ click.echo(f"Node started successfully!")
461
477
 
462
478
 
463
479
  @click.command()
@@ -484,7 +500,7 @@ def stop_node():
484
500
  click.echo(f"Warning: Process {pid} already stopped or does not exist.")
485
501
 
486
502
  os.remove("node_pid.txt")
487
- click.echo(f"Node stopped successfully! {len(pids)} processes terminated.")
503
+ click.echo(f"Node stopped successfully!")
488
504
 
489
505
  except FileNotFoundError:
490
506
  click.echo("Error: No active node process found.")
@@ -513,6 +529,13 @@ def register_node():
513
529
  except Exception as e:
514
530
  print(f"Error reading .env file: {e}")
515
531
  return
532
+
533
+ node_type = questionary.select(
534
+ "Choose Node type:",
535
+ choices=["public", "private"]
536
+ ).ask()
537
+
538
+ descr = click.prompt("Node description (max. 25 characters)")
516
539
 
517
540
  try:
518
541
  with open("NODE.md", "r") as f:
@@ -525,10 +548,11 @@ def register_node():
525
548
  print(f"Error reading NODE.md file: {e}")
526
549
  return
527
550
 
528
- url = f"https://{network}/api/register_node"
551
+ url = f"https://{network}/api/register_node/{node_type}"
529
552
 
530
553
  node = {
531
554
  "nodeID": nodeID,
555
+ "descr": descr,
532
556
  "host": host,
533
557
  "password": password,
534
558
  "synapse": synapse,
@@ -384,7 +384,6 @@ class Cell:
384
384
  self.sock = context.wrap_socket(raw_sock, server_hostname=self.network)
385
385
 
386
386
  try:
387
- print(f"Connecting to {self.network}")
388
387
  self.sock.connect((self.network, 55555))
389
388
 
390
389
  if not self.authenticate(stx):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuronum
3
- Version: 2.0.6
3
+ Version: 2.0.8
4
4
  Summary: Official client library to interact with the Neuronum Network
5
5
  Home-page: https://neuronum.net
6
6
  Author: Neuronum Cybernetics
@@ -35,8 +35,8 @@ Dynamic: summary
35
35
 
36
36
  Build, deploy and automate serverless data infrastructures for an interconnected world with `Neuronum`
37
37
 
38
- ### **What's New in neuronum==2.0.6?**
39
- - **Nodes/Node-CLI**: Improved logic: `neuronum init-node` now supports multiple --stream and --sync flags for better flexibility
38
+ ### **What's New in neuronum==2.0.8?**
39
+ - **Nodes/Node-CLI**: Improved default template for `neuronum init-node`
40
40
 
41
41
  ### New Feature Set
42
42
  - **Cells/Cell-CLI**: Create and manage Neuronum Cells from the command line
@@ -44,7 +44,7 @@ Build, deploy and automate serverless data infrastructures for an interconnected
44
44
  - **Transmitters (TX)**: Automate economic data transfer
45
45
  - **Circuits (CTX)**: Store data in Key-Value-Label databases
46
46
  - **Streams (STX)**: Stream, synchronize and control data in real time
47
- - **Contracts/Tokens**: Automate services exchange and authorization between Cells and Nodes
47
+ - **Contracts/Tokens**: Automate service exchange and authorization between Cells and Nodes
48
48
  - **Cellai**: A local running task assistant in development (version 0.0.1)
49
49
 
50
50
  ### Installation
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='neuronum',
5
- version='2.0.6',
5
+ version='2.0.8',
6
6
  author='Neuronum Cybernetics',
7
7
  author_email='welcome@neuronum.net',
8
8
  description='Official client library to interact with the Neuronum Network',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes