neuronum 3.0.0__py3-none-any.whl → 3.0.1__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,11 @@ 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
+ descr = click.prompt("Node description (max. 25 characters)")
586
+ asyncio.run(async_connect_node(descr))
565
587
 
566
- async def async_register_node():
588
+ async def async_connect_node(descr):
567
589
  env_data = {}
568
590
  try:
569
591
  with open(".env", "r") as f:
@@ -583,13 +605,6 @@ async def async_register_node():
583
605
  except Exception as e:
584
606
  print(f"Error reading .env file: {e}")
585
607
  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
608
 
594
609
  try:
595
610
  with open("NODE.md", "r") as f:
@@ -602,7 +617,7 @@ async def async_register_node():
602
617
  print(f"Error reading NODE.md file: {e}")
603
618
  return
604
619
 
605
- url = f"https://{network}/api/register_node/{node_type}"
620
+ url = f"https://{network}/api/connect_node"
606
621
 
607
622
  node = {
608
623
  "nodeID": nodeID,
@@ -623,8 +638,11 @@ async def async_register_node():
623
638
  except aiohttp.ClientError as e:
624
639
  click.echo(f"Error sending request: {e}")
625
640
  return
626
-
627
- click.echo(f"Neuronum Node '{nodeID}' registered! Visit: {node_url}")
641
+
642
+ if nodeID == "Node does not exist":
643
+ click.echo(f"Neuronum Node not found! Make sure you initialized your Node correctly")
644
+ else:
645
+ click.echo(f"Neuronum Node '{nodeID}' connected! Visit: {node_url}")
628
646
 
629
647
 
630
648
  @click.command()
@@ -708,6 +726,53 @@ async def async_update_node():
708
726
  click.echo(f"Neuronum Node '{nodeID}' updated! Visit: {node_url}")
709
727
 
710
728
 
729
+ @click.command()
730
+ def disconnect_node():
731
+ asyncio.run(async_disconnect_node())
732
+
733
+ async def async_disconnect_node():
734
+ env_data = {}
735
+
736
+ try:
737
+ with open(".env", "r") as f:
738
+ for line in f:
739
+ key, value = line.strip().split("=")
740
+ env_data[key] = value
741
+
742
+ nodeID = env_data.get("NODE", "")
743
+ host = env_data.get("HOST", "")
744
+ password = env_data.get("PASSWORD", "")
745
+ network = env_data.get("NETWORK", "")
746
+ synapse = env_data.get("SYNAPSE", "")
747
+
748
+ except FileNotFoundError:
749
+ click.echo("Error: .env with credentials not found")
750
+ return
751
+ except Exception as e:
752
+ click.echo(f"Error reading .env file: {e}")
753
+ return
754
+
755
+ url = f"https://{network}/api/disconnect_node"
756
+ node_payload = {
757
+ "nodeID": nodeID,
758
+ "host": host,
759
+ "password": password,
760
+ "synapse": synapse
761
+ }
762
+
763
+ async with aiohttp.ClientSession() as session:
764
+ try:
765
+ async with session.post(url, json=node_payload) as response:
766
+ response.raise_for_status()
767
+ data = await response.json()
768
+ nodeID = data["nodeID"]
769
+ except aiohttp.ClientError as e:
770
+ click.echo(f"Error sending request: {e}")
771
+ return
772
+
773
+ click.echo(f"Neuronum Node '{nodeID}' disconnected!")
774
+
775
+
711
776
  @click.command()
712
777
  def delete_node():
713
778
  asyncio.run(async_delete_node())
@@ -755,6 +820,7 @@ async def async_delete_node():
755
820
  click.echo(f"Neuronum Node '{nodeID}' deleted!")
756
821
 
757
822
 
823
+
758
824
  @click.command()
759
825
  def call_cellai():
760
826
  try:
@@ -772,8 +838,9 @@ cli.add_command(delete_cell)
772
838
  cli.add_command(init_node)
773
839
  cli.add_command(start_node)
774
840
  cli.add_command(stop_node)
775
- cli.add_command(register_node)
841
+ cli.add_command(connect_node)
776
842
  cli.add_command(update_node)
843
+ cli.add_command(disconnect_node)
777
844
  cli.add_command(delete_node)
778
845
  cli.add_command(call_cellai)
779
846
 
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.1
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.1**
41
+ - Added CLI commands: `neuronum connect-node` and `neuronum disconnect-node` for improved Node management and seamless integration.
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.
@@ -87,7 +86,7 @@ $ neuronum init-node # initialize a Node with default template
87
86
 
88
87
  cd into Node Folder:
89
88
  ```sh
90
- $ cd node_your_node_id # change directory
89
+ $ cd node_nodeID # change directory
91
90
  ```
92
91
 
93
92
  Start your Node:
@@ -99,3 +98,23 @@ Stop your Node:
99
98
  ```sh
100
99
  $ neuronum stop-node # stop Node
101
100
  ```
101
+
102
+ Connect your Node:
103
+ ```sh
104
+ $ neuronum connect-node # connect your Node / Node description = Test Node
105
+ ```
106
+
107
+ Update your Node:
108
+ ```sh
109
+ $ neuronum update-node # update your Node
110
+ ```
111
+
112
+ Disconnect your Node:
113
+ ```sh
114
+ $ neuronum disconnect-node # disconnect your Node
115
+ ```
116
+
117
+ Delete your Node:
118
+ ```sh
119
+ $ neuronum delete-node # delete your Node
120
+ ```
@@ -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=Po8hDuhQIDR7Te_uQnFBg_xq51UXJlh4YsmtWkB4kuw,25456
5
+ neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
6
+ neuronum/neuronum.py,sha256=VUwdF3ynOtZHTASnKzSaHG5GWWfG-oAXxdcGDftbuFE,21412
7
+ neuronum-3.0.1.dist-info/licenses/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
8
+ neuronum-3.0.1.dist-info/METADATA,sha256=mOE1bSRp1lAaJ4zNx3UD2ZRFfbladCbq97TMbwIW59E,4218
9
+ neuronum-3.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ neuronum-3.0.1.dist-info/entry_points.txt,sha256=XKYBcRNxGeJpZZkDPsa8HA_RaJ7Km_R_JaUq5T9Nk2U,42
11
+ neuronum-3.0.1.dist-info/top_level.txt,sha256=gqN5tyGnBKMPSzvWQONO4rpTf4gQPMi77O3KAKx88LQ,20
12
+ neuronum-3.0.1.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,,