neuronum 3.0.0__py3-none-any.whl → 3.0.2__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 CHANGED
@@ -321,8 +321,29 @@ async def async_init_node(sync, stream):
321
321
  await asyncio.to_thread(gitignore_path.write_text, ".env\n")
322
322
 
323
323
  nodemd_path = project_path / "NODE.md"
324
- await asyncio.to_thread(nodemd_path.write_text, "## Use this NODE.md file to add instructions on how to interact with your node\n")
325
-
324
+ await asyncio.to_thread(nodemd_path.write_text, """### Getting started template: Neuronum NODE.md
325
+ ### Use this .md file to add instructions on how to interact with your Node
326
+
327
+ ```json
328
+ {
329
+ "Use Case": "Getting started Node streaming: Hello, Neuronum!",
330
+ "Requirements": [
331
+ {
332
+ "name": "Python",
333
+ "version": ">= 3.8",
334
+ "link": "https://www.python.org/downloads/"
335
+ },
336
+ {
337
+ "name": "Neuronum Lib",
338
+ "version": ">= 3.0.1",
339
+ "link": "https://pypi.org/project/neuronum/"
340
+ }
341
+ ],
342
+ "Installation": "pip install neuronum",
343
+ "Initialization": "neuronum init-node"
344
+ }
345
+ ```"""
346
+ )
326
347
 
327
348
  stx = sync[0] if sync else (stream[0] if stream else host.replace("::cell", "::stx"))
328
349
 
@@ -560,10 +581,15 @@ async def async_stop_node():
560
581
 
561
582
 
562
583
  @click.command()
563
- def register_node():
564
- asyncio.run(async_register_node())
584
+ def connect_node():
585
+ node_type = questionary.select(
586
+ "Choose Node type:",
587
+ choices=["public", "private"]
588
+ ).ask()
589
+ descr = click.prompt("Node description (max. 25 characters)")
590
+ asyncio.run(async_connect_node(descr, node_type))
565
591
 
566
- async def async_register_node():
592
+ async def async_connect_node(descr, node_type):
567
593
  env_data = {}
568
594
  try:
569
595
  with open(".env", "r") as f:
@@ -583,13 +609,6 @@ async def async_register_node():
583
609
  except Exception as e:
584
610
  print(f"Error reading .env file: {e}")
585
611
  return
586
-
587
- node_type = questionary.select(
588
- "Choose Node type:",
589
- choices=["public", "private"]
590
- ).ask()
591
-
592
- descr = click.prompt("Node description (max. 25 characters)")
593
612
 
594
613
  try:
595
614
  with open("NODE.md", "r") as f:
@@ -602,7 +621,7 @@ async def async_register_node():
602
621
  print(f"Error reading NODE.md file: {e}")
603
622
  return
604
623
 
605
- url = f"https://{network}/api/register_node/{node_type}"
624
+ url = f"https://{network}/api/connect_node/{node_type}"
606
625
 
607
626
  node = {
608
627
  "nodeID": nodeID,
@@ -623,8 +642,14 @@ async def async_register_node():
623
642
  except aiohttp.ClientError as e:
624
643
  click.echo(f"Error sending request: {e}")
625
644
  return
626
-
627
- click.echo(f"Neuronum Node '{nodeID}' registered! Visit: {node_url}")
645
+
646
+ if nodeID == "Node does not exist":
647
+ click.echo(f"Neuronum Node not found! Make sure you initialized your Node correctly")
648
+ else:
649
+ if node_type == "public":
650
+ click.echo(f"Public Neuronum Node '{nodeID}' connected! Visit: {node_url}")
651
+ else:
652
+ click.echo(f"Private Neuronum Node '{nodeID}' connected!")
628
653
 
629
654
 
630
655
  @click.command()
@@ -708,6 +733,53 @@ async def async_update_node():
708
733
  click.echo(f"Neuronum Node '{nodeID}' updated! Visit: {node_url}")
709
734
 
710
735
 
736
+ @click.command()
737
+ def disconnect_node():
738
+ asyncio.run(async_disconnect_node())
739
+
740
+ async def async_disconnect_node():
741
+ env_data = {}
742
+
743
+ try:
744
+ with open(".env", "r") as f:
745
+ for line in f:
746
+ key, value = line.strip().split("=")
747
+ env_data[key] = value
748
+
749
+ nodeID = env_data.get("NODE", "")
750
+ host = env_data.get("HOST", "")
751
+ password = env_data.get("PASSWORD", "")
752
+ network = env_data.get("NETWORK", "")
753
+ synapse = env_data.get("SYNAPSE", "")
754
+
755
+ except FileNotFoundError:
756
+ click.echo("Error: .env with credentials not found")
757
+ return
758
+ except Exception as e:
759
+ click.echo(f"Error reading .env file: {e}")
760
+ return
761
+
762
+ url = f"https://{network}/api/disconnect_node"
763
+ node_payload = {
764
+ "nodeID": nodeID,
765
+ "host": host,
766
+ "password": password,
767
+ "synapse": synapse
768
+ }
769
+
770
+ async with aiohttp.ClientSession() as session:
771
+ try:
772
+ async with session.post(url, json=node_payload) as response:
773
+ response.raise_for_status()
774
+ data = await response.json()
775
+ nodeID = data["nodeID"]
776
+ except aiohttp.ClientError as e:
777
+ click.echo(f"Error sending request: {e}")
778
+ return
779
+
780
+ click.echo(f"Neuronum Node '{nodeID}' disconnected!")
781
+
782
+
711
783
  @click.command()
712
784
  def delete_node():
713
785
  asyncio.run(async_delete_node())
@@ -755,6 +827,7 @@ async def async_delete_node():
755
827
  click.echo(f"Neuronum Node '{nodeID}' deleted!")
756
828
 
757
829
 
830
+
758
831
  @click.command()
759
832
  def call_cellai():
760
833
  try:
@@ -772,8 +845,9 @@ cli.add_command(delete_cell)
772
845
  cli.add_command(init_node)
773
846
  cli.add_command(start_node)
774
847
  cli.add_command(stop_node)
775
- cli.add_command(register_node)
848
+ cli.add_command(connect_node)
776
849
  cli.add_command(update_node)
850
+ cli.add_command(disconnect_node)
777
851
  cli.add_command(delete_node)
778
852
  cli.add_command(call_cellai)
779
853
 
neuronum/neuronum.py CHANGED
@@ -73,7 +73,6 @@ class Cell:
73
73
 
74
74
 
75
75
  async def activate_tx(self, txID: str, data: dict):
76
- """Asynchronously sends TX activation request to the API."""
77
76
  url = f"https://{self.network}/api/activate_tx/{txID}"
78
77
 
79
78
  TX = {
@@ -84,10 +83,10 @@ class Cell:
84
83
  async with aiohttp.ClientSession() as session:
85
84
  try:
86
85
  async with session.post(url, json=TX) as response:
86
+ response.raise_for_status()
87
87
  response.raise_for_status()
88
88
  data = await response.json()
89
- print(f"Response from Neuronum: {data}")
90
- return data
89
+ print(data["message"])
91
90
 
92
91
  except aiohttp.ClientError as e:
93
92
  print(f"Error sending request: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuronum
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: Official client library to interact with the Neuronum Network
5
5
  Home-page: https://neuronum.net
6
6
  Author: Neuronum Cybernetics
@@ -37,12 +37,11 @@ Dynamic: summary
37
37
 
38
38
  A Getting Started into the Neuronum Network: Build, deploy and automate serverless data infrastructures for an interconnected world
39
39
 
40
- ### **What's New in neuronum==3.0.0?**
41
- - Complete library shift to async, ensuring non-blocking execution.
42
- - New cell.scan() function, enabling discovery of Cells and Nodes via the Bleak BLE Client.
40
+ ### **What's New in neuronum 3.0.2**
41
+ - Added CLI feature in `neuronum connect-node`: Select whether your Node will be publicly or privately listed
43
42
 
44
43
  ### **New Feature Set**
45
- - **Cells/Cell-CLI**: Create and manage your Neuronum Cell, your unique identity for interacting with the Network, directly from the command line.
44
+ - **Cell/Cell-CLI**: Create and manage your Neuronum Cell, a unique identity for interacting with the Network, directly from the command line.
46
45
  - **Nodes/Node-CLI**: Setup and manage Neuronum Nodes, the software and hardware components that power the Network, via the command line.
47
46
  - **Transmitters (TX)**: Automate economic data transfer using predefined templates for standardized data exchange.
48
47
  - **Circuits (CTX)**: Store, manage, and retrieve structured data with Circuits, a cloud-based Key-Value-Label database.
@@ -74,6 +73,11 @@ Create your Cell:
74
73
  $ neuronum create-cell # create Cell / select network and type
75
74
  ```
76
75
 
76
+ Connect your Cell:
77
+ ```sh
78
+ $ neuronum connect-cell # connect Cell
79
+ ```
80
+
77
81
  View connected Cell:
78
82
  ```sh
79
83
  $ neuronum view-cell # view Cell ID / output = Connected Cell: 'your_cell_id'"
@@ -87,7 +91,7 @@ $ neuronum init-node # initialize a Node with default template
87
91
 
88
92
  cd into Node Folder:
89
93
  ```sh
90
- $ cd node_your_node_id # change directory
94
+ $ cd node_nodeID # change directory
91
95
  ```
92
96
 
93
97
  Start your Node:
@@ -99,3 +103,23 @@ Stop your Node:
99
103
  ```sh
100
104
  $ neuronum stop-node # stop Node
101
105
  ```
106
+
107
+ Connect your Node:
108
+ ```sh
109
+ $ neuronum connect-node # connect your Node / Node description = Test Node
110
+ ```
111
+
112
+ Update your Node:
113
+ ```sh
114
+ $ neuronum update-node # update your Node
115
+ ```
116
+
117
+ Disconnect your Node:
118
+ ```sh
119
+ $ neuronum disconnect-node # disconnect your Node
120
+ ```
121
+
122
+ Delete your Node:
123
+ ```sh
124
+ $ neuronum delete-node # delete your Node
125
+ ```
@@ -0,0 +1,12 @@
1
+ cellai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ cellai/cellai.py,sha256=g5oBz-Xx6T4-JWzUs-TJ4y9nHtDmA_IpXh_188OqAZA,281
3
+ cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ cli/main.py,sha256=zwvr856X5xoHZAsGu4MdCfK804u8Mvm7n-9aAiFNbAc,25745
5
+ neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
6
+ neuronum/neuronum.py,sha256=VUwdF3ynOtZHTASnKzSaHG5GWWfG-oAXxdcGDftbuFE,21412
7
+ neuronum-3.0.2.dist-info/licenses/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
8
+ neuronum-3.0.2.dist-info/METADATA,sha256=6u7_NhiR6YiH--UMiRs4JATVkrf8GJ-wNTFxZuBEXHo,4277
9
+ neuronum-3.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ neuronum-3.0.2.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
11
+ neuronum-3.0.2.dist-info/top_level.txt,sha256=gqN5tyGnBKMPSzvWQONO4rpTf4gQPMi77O3KAKx88LQ,20
12
+ neuronum-3.0.2.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- cellai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cellai/cellai.py,sha256=g5oBz-Xx6T4-JWzUs-TJ4y9nHtDmA_IpXh_188OqAZA,281
3
- cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- cli/main.py,sha256=DgLtRpZ9rSM1OkPGxMH-Gy5731MzwjWedOb02ktQsxc,23442
5
- neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
6
- neuronum/neuronum.py,sha256=IQU9o2s2hbYLxluYW4Y-aj1xh0ygUzENM0hnezpUgvE,21484
7
- neuronum-3.0.0.dist-info/licenses/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
8
- neuronum-3.0.0.dist-info/METADATA,sha256=lJHSYgOuxnufPfFf-wNZFehM2ep0amKRO8rHQPc9Z5E,3876
9
- neuronum-3.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- neuronum-3.0.0.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
11
- neuronum-3.0.0.dist-info/top_level.txt,sha256=gqN5tyGnBKMPSzvWQONO4rpTf4gQPMi77O3KAKx88LQ,20
12
- neuronum-3.0.0.dist-info/RECORD,,