naeural-client 2.6.14__tar.gz → 2.6.16__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.
Files changed (144) hide show
  1. naeural_client-2.6.16/PKG-INFO +279 -0
  2. naeural_client-2.6.16/README.md +256 -0
  3. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/_ver.py +1 -1
  4. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/generic_session.py +251 -75
  5. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/bc/base.py +1 -1
  6. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/apps.py +1 -0
  7. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/base.py +3 -0
  8. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/session/mqtt_session.py +19 -4
  9. {naeural_client-2.6.14 → naeural_client-2.6.16}/pyproject.toml +1 -1
  10. naeural_client-2.6.14/PKG-INFO +0 -358
  11. naeural_client-2.6.14/README.md +0 -335
  12. {naeural_client-2.6.14 → naeural_client-2.6.16}/.devcontainer/Dockerfile +0 -0
  13. {naeural_client-2.6.14 → naeural_client-2.6.16}/.devcontainer/devcontainer.json +0 -0
  14. {naeural_client-2.6.14 → naeural_client-2.6.16}/.gitattributes +0 -0
  15. {naeural_client-2.6.14 → naeural_client-2.6.16}/.github/workflows/python-publish.yml +0 -0
  16. {naeural_client-2.6.14 → naeural_client-2.6.16}/.gitignore +0 -0
  17. {naeural_client-2.6.14 → naeural_client-2.6.16}/.vscode/launch.json +0 -0
  18. {naeural_client-2.6.14 → naeural_client-2.6.16}/LICENSE +0 -0
  19. {naeural_client-2.6.14 → naeural_client-2.6.16}/TODOs.md +0 -0
  20. {naeural_client-2.6.14 → naeural_client-2.6.16}/__init__.py +0 -0
  21. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/__init__.py +0 -0
  22. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/__init__.py +0 -0
  23. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/distributed_custom_code_presets.py +0 -0
  24. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/instance.py +0 -0
  25. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/payload/__init__.py +0 -0
  26. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/payload/payload.py +0 -0
  27. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/pipeline.py +0 -0
  28. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/plugin_template.py +0 -0
  29. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/responses.py +0 -0
  30. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/transaction.py +0 -0
  31. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base/webapp_pipeline.py +0 -0
  32. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/base_decentra_object.py +0 -0
  33. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/bc/__init__.py +0 -0
  34. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/bc/chain.py +0 -0
  35. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/bc/ec.py +0 -0
  36. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/certs/__init__.py +0 -0
  37. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
  38. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/cli/README.md +0 -0
  39. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/cli/cli.py +0 -0
  40. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/cli/cli_commands.py +0 -0
  41. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/cli/nodes.py +0 -0
  42. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/code_cheker/__init__.py +0 -0
  43. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/code_cheker/base.py +0 -0
  44. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/code_cheker/checker.py +0 -0
  45. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/comm/__init__.py +0 -0
  46. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/comm/amqp_wrapper.py +0 -0
  47. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/comm/mqtt_wrapper.py +0 -0
  48. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/README.md +0 -0
  49. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/__init__.py +0 -0
  50. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/comms.py +0 -0
  51. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/environment.py +0 -0
  52. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/formatter.py +0 -0
  53. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/heartbeat.py +0 -0
  54. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/misc.py +0 -0
  55. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/const/payload.py +0 -0
  56. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/__init__.py +0 -0
  57. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/__init__.py +0 -0
  58. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
  59. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/custom_webapi_01_plugin.py +0 -0
  60. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
  61. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +0 -0
  62. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +0 -0
  63. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
  64. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/__init__.py +0 -0
  65. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/base/__init__.py +0 -0
  66. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/base/base_formatter.py +0 -0
  67. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/default/__init__.py +0 -0
  68. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/default/a_dummy.py +0 -0
  69. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/default/aixp1.py +0 -0
  70. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/default/default.py +0 -0
  71. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
  72. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/__init__.py +0 -0
  73. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/base_logger.py +0 -0
  74. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/__init__.py +0 -0
  75. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
  76. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
  77. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
  78. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
  79. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
  80. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
  81. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
  82. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
  83. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
  84. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
  85. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
  86. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
  87. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/small_logger.py +0 -0
  88. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/tzlocal/__init__.py +0 -0
  89. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/tzlocal/unix.py +0 -0
  90. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/tzlocal/utils.py +0 -0
  91. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/tzlocal/win32.py +0 -0
  92. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
  93. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/plugins_manager_mixin.py +0 -0
  94. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/utils/__init__.py +0 -0
  95. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/utils/comm_utils.py +0 -0
  96. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/utils/config.py +0 -0
  97. {naeural_client-2.6.14 → naeural_client-2.6.16}/naeural_client/utils/dotenv.py +0 -0
  98. {naeural_client-2.6.14 → naeural_client-2.6.16}/nepctl.MD +0 -0
  99. {naeural_client-2.6.14 → naeural_client-2.6.16}/requirements.txt +0 -0
  100. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/.example_env +0 -0
  101. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
  102. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
  103. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/_example_pk_sdk.pem +0 -0
  104. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex01_part1_connect.py +0 -0
  105. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex01_part2_filter.py +0 -0
  106. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex01_part3_adv_filter.py +0 -0
  107. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex02_first_deploy.py +0 -0
  108. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
  109. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
  110. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
  111. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
  112. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
  113. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex08_custom_webapi.py +0 -0
  114. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
  115. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex10_telegram_echo_bot.py +0 -0
  116. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex11_telegram_blackjack_bot.py +0 -0
  117. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex12_telegram_smart_bot.py +0 -0
  118. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/ex13_launch_repo_based_webapp.py +0 -0
  119. {naeural_client-2.6.14 → naeural_client-2.6.16}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
  120. {naeural_client-2.6.14 → naeural_client-2.6.16}/winrun.bat +0 -0
  121. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/.example_env +0 -0
  122. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/_archive/test.py +0 -0
  123. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/_tutorials/3. simple_real_time_custom_code.py +0 -0
  124. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/_tutorials/4. real_time_custom_code_2.py +0 -0
  125. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/_tutorials/8. chatbot.py +0 -0
  126. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/auth/t1.py +0 -0
  127. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/check_local_keys/check1.py +0 -0
  128. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/decentralized/chain_dist_example.py +0 -0
  129. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
  130. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
  131. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/enc_dec/enc_dec_test.py +0 -0
  132. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/eth/eth_sign.py +0 -0
  133. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/eth/info.md +0 -0
  134. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/eth/sign.py +0 -0
  135. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/multi-enc-dec/multi_test1.py +0 -0
  136. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/multi-enc-dec/multi_test2.py +0 -0
  137. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/sign/test_sign1.py +0 -0
  138. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/utils/get_documentation.py +0 -0
  139. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/README.md +0 -0
  140. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/attach_example.py +0 -0
  141. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/ex1.py +0 -0
  142. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/hello.py +0 -0
  143. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/remote_exec.py +0 -0
  144. {naeural_client-2.6.14 → naeural_client-2.6.16}/xperimental/various/save_images.py +0 -0
@@ -0,0 +1,279 @@
1
+ Metadata-Version: 2.4
2
+ Name: naeural_client
3
+ Version: 2.6.16
4
+ Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
+ Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
+ Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
7
+ Author-email: Andrei Ionut Damian <andrei.damian@me.com>, Cristan Bleotiu <cristibleotiu@gmail.com>, Stefan Saraev <saraevstefan@gmail.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Requires-Dist: cryptography>=39.0.0
14
+ Requires-Dist: numpy
15
+ Requires-Dist: paho-mqtt
16
+ Requires-Dist: pandas
17
+ Requires-Dist: pika
18
+ Requires-Dist: pyaml
19
+ Requires-Dist: pyopenssl>=23.0.0
20
+ Requires-Dist: python-dateutil
21
+ Requires-Dist: web3
22
+ Description-Content-Type: text/markdown
23
+
24
+ # Ratio1 SDK
25
+
26
+ Welcome to the **Ratio1 SDK** repository, formerly known as the **naeural_client SDK**. The Ratio1 SDK is a crucial component of the Ratio1 ecosystem, designed to facilitate interactions, development, and deployment of jobs within the Ratio1 network. By enabling low-code development, the SDK allows developers to build and deploy end-to-end AI (and beyond) cooperative application pipelines seamlessly within the Ratio1 Edge Nodes ecosystem.
27
+
28
+ ## Overview
29
+
30
+ The **Ratio1 SDK** is engineered to enhance the Ratio1 protocol and ecosystem, aiming to improve the functionality and performance of the Ratio1 Edge Node through dedicated research and community contributions. This SDK serves as an essential tool for developers looking to integrate their applications with the Ratio1 network, enabling them to leverage the decentralized, secure, and privacy-preserving capabilities of Ratio1 Edge Nodes.
31
+
32
+ Key functionalities of the Ratio1 SDK include:
33
+
34
+ - **Job Interactions**: Facilitate the development and management of computation tasks within the Ratio1 network.
35
+ - **Development Tools**: Provide low-code solutions for creating and deploying AI-driven application pipelines.
36
+ - **Ecosystem Integration**: Seamlessly integrate with Ratio1 Edge Nodes to utilize their computational resources effectively.
37
+ - **Collaboration and Deployment**: Enable cooperative application development and deployment across multiple edge nodes within the Ratio1 ecosystem.
38
+
39
+ Unlike the Ratio1 Core Packages, which are intended solely for protocol and ecosystem enhancements and are not meant for standalone installation, the Ratio1 SDK is designed for both client-side development and sending workloads to Ratio1 Edge Nodes, making it an indispensable tool for developers within the ecosystem.
40
+
41
+ ## Dependencies
42
+
43
+ The Ratio1 SDK relies on several key packages to function effectively. These dependencies are automatically managed when installing the SDK via pip:
44
+
45
+ - `pika`
46
+ - `paho-mqtt`
47
+ - `numpy`
48
+ - `pyopenssl>=23.0.0`
49
+ - `cryptography>=39.0.0`
50
+ - `python-dateutil`
51
+ - `pyaml`
52
+
53
+ ## Installation
54
+
55
+ Installing the Ratio1 SDK is straightforward and is intended for development and integration into your projects. Use the following pip commands to install the SDK:
56
+
57
+ ### Standard Installation
58
+
59
+ To install the Ratio1 SDK, run:
60
+
61
+ ```shell
62
+ pip install ratio1_sdk --upgrade
63
+ ```
64
+
65
+ ### Development Installation
66
+
67
+ For development purposes, you can clone the repository and set up the SDK in an editable mode:
68
+
69
+ ```shell
70
+ git clone https://github.com/Ratio1/ratio1_sdk
71
+ cd ratio1_sdk
72
+ pip install -e .
73
+ ```
74
+
75
+ This allows you to make modifications to the SDK and have them reflected immediately without reinstalling.
76
+
77
+ ## Documentation
78
+
79
+ Comprehensive documentation for the Ratio1 SDK is currently a work in progress. Minimal documentation is available here, with detailed code examples located in the `tutorials` folder within the project's repository. We encourage developers to explore these examples to understand the SDK's capabilities and integration methods.
80
+
81
+ ## Quick Start Guides
82
+
83
+ Starting with version 2.6+, the Ratio1 SDK automatically performs self-configuration using **dAuth**—the Ratio1 decentralized self-authentication system. To begin integrating with the Ratio1 network, follow these steps:
84
+
85
+ ### 1. Start a Local Edge Node
86
+
87
+ Launch a local Ratio1 Edge Node using Docker:
88
+
89
+ ```bash
90
+ docker run -d --name=local_node ratio1/edge_node:develop
91
+ ```
92
+
93
+ After a few seconds, the node will be online. Retrieve the node's address by running:
94
+
95
+ ```bash
96
+ docker exec local_node get_node_info
97
+ ```
98
+
99
+ The output will resemble:
100
+
101
+ ```json
102
+ {
103
+ "address": "0xai_AtMvIwaEPi5M8cnkdbaZ3tbUhCzKbGKEYuZ1xFtCjT_6",
104
+ "alias": "6dd74472642e",
105
+ "eth_address": "0x98FE7c0d8CeC2E97B932D2bDC1bb73B395C9Dfd7"
106
+ }
107
+ ```
108
+
109
+ ### 2. Develop and Deploy Jobs
110
+
111
+ Use the SDK to develop and send workloads to the Edge Nodes. Below are examples of both local and remote execution.
112
+
113
+ ## Examples
114
+
115
+ ### Local Execution
116
+
117
+ This example demonstrates how to find all 168 prime numbers in the interval 1 - 1000 using local execution. The code leverages multiple threads to perform prime number generation efficiently.
118
+
119
+ ```python
120
+ import numpy as np
121
+ from concurrent.futures import ThreadPoolExecutor
122
+
123
+ def local_brute_force_prime_number_generator():
124
+ def is_prime(n):
125
+ if n <= 1:
126
+ return False
127
+ for i in range(2, int(np.sqrt(n)) + 1):
128
+ if n % i == 0:
129
+ return False
130
+ return True
131
+
132
+ random_numbers = np.random.randint(1, 1000, 20)
133
+
134
+ thread_pool = ThreadPoolExecutor(max_workers=4)
135
+ are_primes = list(thread_pool.map(is_prime, random_numbers))
136
+
137
+ prime_numbers = []
138
+ for i in range(len(random_numbers)):
139
+ if are_primes[i]:
140
+ prime_numbers.append(random_numbers[i])
141
+
142
+ return prime_numbers
143
+
144
+ if __name__ == "__main__":
145
+ found_so_far = []
146
+ print_step = 0
147
+
148
+ while len(found_so_far) < 168:
149
+ # Compute a batch of prime numbers
150
+ prime_numbers = local_brute_force_prime_number_generator()
151
+
152
+ # Keep only the new prime numbers
153
+ for prime_number in prime_numbers:
154
+ if prime_number not in found_so_far:
155
+ found_so_far.append(prime_number)
156
+
157
+ # Show progress
158
+ if print_step % 50 == 0:
159
+ print("Found so far: {}: {}\n".format(len(found_so_far), sorted(found_so_far)))
160
+
161
+ print_step += 1
162
+
163
+ # Show final result
164
+ print("Found so far: {}: {}\n".format(len(found_so_far), sorted(found_so_far)))
165
+ ```
166
+
167
+ ### Remote Execution
168
+
169
+ To accelerate prime number discovery, this example demonstrates deploying the task across multiple edge nodes within the Ratio1 network. Minimal code changes are required to transition from local to remote execution.
170
+
171
+ #### 1. Modify the Prime Number Generator
172
+
173
+ ```python
174
+ from ratio1_sdk import CustomPluginTemplate
175
+
176
+ def remote_brute_force_prime_number_generator(plugin: CustomPluginTemplate):
177
+ def is_prime(n):
178
+ if n <= 1:
179
+ return False
180
+ for i in range(2, int(plugin.np.sqrt(n)) + 1):
181
+ if n % i == 0:
182
+ return False
183
+ return True
184
+
185
+ random_numbers = plugin.np.random.randint(1, 1000, 20)
186
+ are_primes = plugin.threadapi_map(is_prime, random_numbers, n_threads=4)
187
+
188
+ prime_numbers = []
189
+ for i in range(len(random_numbers)):
190
+ if are_primes[i]:
191
+ prime_numbers.append(random_numbers[i])
192
+
193
+ return prime_numbers
194
+ ```
195
+
196
+ #### 2. Connect to the Network and Select a Node
197
+
198
+ ```python
199
+ from ratio1_sdk import Session
200
+ from time import sleep
201
+
202
+ def on_heartbeat(session: Session, node: str, heartbeat: dict):
203
+ session.P("{} is online".format(node))
204
+ return
205
+
206
+ if __name__ == '__main__':
207
+ session = Session(
208
+ on_heartbeat=on_heartbeat
209
+ )
210
+
211
+ # Run the program for 15 seconds to detect online nodes
212
+ sleep(15)
213
+
214
+ # Retrieve and select an online node
215
+ node = "0xai_A8SY7lEqBtf5XaGyB6ipdk5C30vSf3HK4xELp3iplwLe" # naeural-1
216
+ ```
217
+
218
+ #### 3. Deploy the Distributed Job
219
+
220
+ ```python
221
+ from ratio1_sdk import DistributedCustomCodePresets as Presets
222
+
223
+ _, _ = session.create_chain_dist_custom_job(
224
+ node=node,
225
+ main_node_process_real_time_collected_data=Presets.PROCESS_REAL_TIME_COLLECTED_DATA__KEEP_UNIQUES_IN_AGGREGATED_COLLECTED_DATA,
226
+ main_node_finish_condition=Presets.FINISH_CONDITION___AGGREGATED_DATA_MORE_THAN_X,
227
+ main_node_finish_condition_kwargs={"X": 167},
228
+ main_node_aggregate_collected_data=Presets.AGGREGATE_COLLECTED_DATA___AGGREGATE_COLLECTED_DATA,
229
+ nr_remote_worker_nodes=2,
230
+ worker_node_code=remote_brute_force_prime_number_generator,
231
+ on_data=locally_process_partial_results,
232
+ deploy=True
233
+ )
234
+ ```
235
+
236
+ #### 4. Close the Session Upon Completion
237
+
238
+ ```python
239
+ # Wait until the finished flag is set to True
240
+ session.run(wait=lambda: not finished, close_pipelines=True)
241
+ ```
242
+
243
+ ## Project Financing Disclaimer
244
+
245
+ This project incorporates open-source components developed with the support of financing grants **SMIS 143488** and **SMIS 156084**, provided by the Romanian Competitiveness Operational Programme. We extend our sincere gratitude for this support, which has been instrumental in advancing our work and enabling us to share these resources with the community.
246
+
247
+ The content and information within this repository are solely the responsibility of the authors and do not necessarily reflect the views of the funding agencies. The grants have specifically supported certain aspects of this open-source project, facilitating broader dissemination and collaborative development.
248
+
249
+ For any inquiries regarding the funding and its impact on this project, please contact the authors directly.
250
+
251
+ ## License
252
+
253
+ This project is licensed under the **Apache 2.0 License**. For more details, please refer to the [LICENSE](LICENSE) file.
254
+
255
+ ## Contact
256
+
257
+ For more information, visit our website at [https://ratio1.ai](https://ratio1.ai) or reach out to us via email at [support@ratio1.ai](mailto:support@ratio1.ai).
258
+
259
+ ## Citation
260
+
261
+ If you use the Ratio1 SDK in your research or projects, please cite it as follows:
262
+
263
+ ```bibtex
264
+ @misc{Ratio1SDK,
265
+ author = {Ratio1.AI},
266
+ title = {Ratio1 SDK},
267
+ year = {2024-2025},
268
+ howpublished = {\url{https://github.com/NaeuralEdgeProtocol/naeural_client}},
269
+ }
270
+ ```
271
+
272
+ ```bibtex
273
+ @misc{Ratio1EdgeNode,
274
+ author = {Ratio1.AI},
275
+ title = {Ratio1: Edge Node},
276
+ year = {2024-2025},
277
+ howpublished = {\url{https://github.com/NaeuralEdgeProtocol/edge_node}},
278
+ }
279
+ ```
@@ -0,0 +1,256 @@
1
+ # Ratio1 SDK
2
+
3
+ Welcome to the **Ratio1 SDK** repository, formerly known as the **naeural_client SDK**. The Ratio1 SDK is a crucial component of the Ratio1 ecosystem, designed to facilitate interactions, development, and deployment of jobs within the Ratio1 network. By enabling low-code development, the SDK allows developers to build and deploy end-to-end AI (and beyond) cooperative application pipelines seamlessly within the Ratio1 Edge Nodes ecosystem.
4
+
5
+ ## Overview
6
+
7
+ The **Ratio1 SDK** is engineered to enhance the Ratio1 protocol and ecosystem, aiming to improve the functionality and performance of the Ratio1 Edge Node through dedicated research and community contributions. This SDK serves as an essential tool for developers looking to integrate their applications with the Ratio1 network, enabling them to leverage the decentralized, secure, and privacy-preserving capabilities of Ratio1 Edge Nodes.
8
+
9
+ Key functionalities of the Ratio1 SDK include:
10
+
11
+ - **Job Interactions**: Facilitate the development and management of computation tasks within the Ratio1 network.
12
+ - **Development Tools**: Provide low-code solutions for creating and deploying AI-driven application pipelines.
13
+ - **Ecosystem Integration**: Seamlessly integrate with Ratio1 Edge Nodes to utilize their computational resources effectively.
14
+ - **Collaboration and Deployment**: Enable cooperative application development and deployment across multiple edge nodes within the Ratio1 ecosystem.
15
+
16
+ Unlike the Ratio1 Core Packages, which are intended solely for protocol and ecosystem enhancements and are not meant for standalone installation, the Ratio1 SDK is designed for both client-side development and sending workloads to Ratio1 Edge Nodes, making it an indispensable tool for developers within the ecosystem.
17
+
18
+ ## Dependencies
19
+
20
+ The Ratio1 SDK relies on several key packages to function effectively. These dependencies are automatically managed when installing the SDK via pip:
21
+
22
+ - `pika`
23
+ - `paho-mqtt`
24
+ - `numpy`
25
+ - `pyopenssl>=23.0.0`
26
+ - `cryptography>=39.0.0`
27
+ - `python-dateutil`
28
+ - `pyaml`
29
+
30
+ ## Installation
31
+
32
+ Installing the Ratio1 SDK is straightforward and is intended for development and integration into your projects. Use the following pip commands to install the SDK:
33
+
34
+ ### Standard Installation
35
+
36
+ To install the Ratio1 SDK, run:
37
+
38
+ ```shell
39
+ pip install ratio1_sdk --upgrade
40
+ ```
41
+
42
+ ### Development Installation
43
+
44
+ For development purposes, you can clone the repository and set up the SDK in an editable mode:
45
+
46
+ ```shell
47
+ git clone https://github.com/Ratio1/ratio1_sdk
48
+ cd ratio1_sdk
49
+ pip install -e .
50
+ ```
51
+
52
+ This allows you to make modifications to the SDK and have them reflected immediately without reinstalling.
53
+
54
+ ## Documentation
55
+
56
+ Comprehensive documentation for the Ratio1 SDK is currently a work in progress. Minimal documentation is available here, with detailed code examples located in the `tutorials` folder within the project's repository. We encourage developers to explore these examples to understand the SDK's capabilities and integration methods.
57
+
58
+ ## Quick Start Guides
59
+
60
+ Starting with version 2.6+, the Ratio1 SDK automatically performs self-configuration using **dAuth**—the Ratio1 decentralized self-authentication system. To begin integrating with the Ratio1 network, follow these steps:
61
+
62
+ ### 1. Start a Local Edge Node
63
+
64
+ Launch a local Ratio1 Edge Node using Docker:
65
+
66
+ ```bash
67
+ docker run -d --name=local_node ratio1/edge_node:develop
68
+ ```
69
+
70
+ After a few seconds, the node will be online. Retrieve the node's address by running:
71
+
72
+ ```bash
73
+ docker exec local_node get_node_info
74
+ ```
75
+
76
+ The output will resemble:
77
+
78
+ ```json
79
+ {
80
+ "address": "0xai_AtMvIwaEPi5M8cnkdbaZ3tbUhCzKbGKEYuZ1xFtCjT_6",
81
+ "alias": "6dd74472642e",
82
+ "eth_address": "0x98FE7c0d8CeC2E97B932D2bDC1bb73B395C9Dfd7"
83
+ }
84
+ ```
85
+
86
+ ### 2. Develop and Deploy Jobs
87
+
88
+ Use the SDK to develop and send workloads to the Edge Nodes. Below are examples of both local and remote execution.
89
+
90
+ ## Examples
91
+
92
+ ### Local Execution
93
+
94
+ This example demonstrates how to find all 168 prime numbers in the interval 1 - 1000 using local execution. The code leverages multiple threads to perform prime number generation efficiently.
95
+
96
+ ```python
97
+ import numpy as np
98
+ from concurrent.futures import ThreadPoolExecutor
99
+
100
+ def local_brute_force_prime_number_generator():
101
+ def is_prime(n):
102
+ if n <= 1:
103
+ return False
104
+ for i in range(2, int(np.sqrt(n)) + 1):
105
+ if n % i == 0:
106
+ return False
107
+ return True
108
+
109
+ random_numbers = np.random.randint(1, 1000, 20)
110
+
111
+ thread_pool = ThreadPoolExecutor(max_workers=4)
112
+ are_primes = list(thread_pool.map(is_prime, random_numbers))
113
+
114
+ prime_numbers = []
115
+ for i in range(len(random_numbers)):
116
+ if are_primes[i]:
117
+ prime_numbers.append(random_numbers[i])
118
+
119
+ return prime_numbers
120
+
121
+ if __name__ == "__main__":
122
+ found_so_far = []
123
+ print_step = 0
124
+
125
+ while len(found_so_far) < 168:
126
+ # Compute a batch of prime numbers
127
+ prime_numbers = local_brute_force_prime_number_generator()
128
+
129
+ # Keep only the new prime numbers
130
+ for prime_number in prime_numbers:
131
+ if prime_number not in found_so_far:
132
+ found_so_far.append(prime_number)
133
+
134
+ # Show progress
135
+ if print_step % 50 == 0:
136
+ print("Found so far: {}: {}\n".format(len(found_so_far), sorted(found_so_far)))
137
+
138
+ print_step += 1
139
+
140
+ # Show final result
141
+ print("Found so far: {}: {}\n".format(len(found_so_far), sorted(found_so_far)))
142
+ ```
143
+
144
+ ### Remote Execution
145
+
146
+ To accelerate prime number discovery, this example demonstrates deploying the task across multiple edge nodes within the Ratio1 network. Minimal code changes are required to transition from local to remote execution.
147
+
148
+ #### 1. Modify the Prime Number Generator
149
+
150
+ ```python
151
+ from ratio1_sdk import CustomPluginTemplate
152
+
153
+ def remote_brute_force_prime_number_generator(plugin: CustomPluginTemplate):
154
+ def is_prime(n):
155
+ if n <= 1:
156
+ return False
157
+ for i in range(2, int(plugin.np.sqrt(n)) + 1):
158
+ if n % i == 0:
159
+ return False
160
+ return True
161
+
162
+ random_numbers = plugin.np.random.randint(1, 1000, 20)
163
+ are_primes = plugin.threadapi_map(is_prime, random_numbers, n_threads=4)
164
+
165
+ prime_numbers = []
166
+ for i in range(len(random_numbers)):
167
+ if are_primes[i]:
168
+ prime_numbers.append(random_numbers[i])
169
+
170
+ return prime_numbers
171
+ ```
172
+
173
+ #### 2. Connect to the Network and Select a Node
174
+
175
+ ```python
176
+ from ratio1_sdk import Session
177
+ from time import sleep
178
+
179
+ def on_heartbeat(session: Session, node: str, heartbeat: dict):
180
+ session.P("{} is online".format(node))
181
+ return
182
+
183
+ if __name__ == '__main__':
184
+ session = Session(
185
+ on_heartbeat=on_heartbeat
186
+ )
187
+
188
+ # Run the program for 15 seconds to detect online nodes
189
+ sleep(15)
190
+
191
+ # Retrieve and select an online node
192
+ node = "0xai_A8SY7lEqBtf5XaGyB6ipdk5C30vSf3HK4xELp3iplwLe" # naeural-1
193
+ ```
194
+
195
+ #### 3. Deploy the Distributed Job
196
+
197
+ ```python
198
+ from ratio1_sdk import DistributedCustomCodePresets as Presets
199
+
200
+ _, _ = session.create_chain_dist_custom_job(
201
+ node=node,
202
+ main_node_process_real_time_collected_data=Presets.PROCESS_REAL_TIME_COLLECTED_DATA__KEEP_UNIQUES_IN_AGGREGATED_COLLECTED_DATA,
203
+ main_node_finish_condition=Presets.FINISH_CONDITION___AGGREGATED_DATA_MORE_THAN_X,
204
+ main_node_finish_condition_kwargs={"X": 167},
205
+ main_node_aggregate_collected_data=Presets.AGGREGATE_COLLECTED_DATA___AGGREGATE_COLLECTED_DATA,
206
+ nr_remote_worker_nodes=2,
207
+ worker_node_code=remote_brute_force_prime_number_generator,
208
+ on_data=locally_process_partial_results,
209
+ deploy=True
210
+ )
211
+ ```
212
+
213
+ #### 4. Close the Session Upon Completion
214
+
215
+ ```python
216
+ # Wait until the finished flag is set to True
217
+ session.run(wait=lambda: not finished, close_pipelines=True)
218
+ ```
219
+
220
+ ## Project Financing Disclaimer
221
+
222
+ This project incorporates open-source components developed with the support of financing grants **SMIS 143488** and **SMIS 156084**, provided by the Romanian Competitiveness Operational Programme. We extend our sincere gratitude for this support, which has been instrumental in advancing our work and enabling us to share these resources with the community.
223
+
224
+ The content and information within this repository are solely the responsibility of the authors and do not necessarily reflect the views of the funding agencies. The grants have specifically supported certain aspects of this open-source project, facilitating broader dissemination and collaborative development.
225
+
226
+ For any inquiries regarding the funding and its impact on this project, please contact the authors directly.
227
+
228
+ ## License
229
+
230
+ This project is licensed under the **Apache 2.0 License**. For more details, please refer to the [LICENSE](LICENSE) file.
231
+
232
+ ## Contact
233
+
234
+ For more information, visit our website at [https://ratio1.ai](https://ratio1.ai) or reach out to us via email at [support@ratio1.ai](mailto:support@ratio1.ai).
235
+
236
+ ## Citation
237
+
238
+ If you use the Ratio1 SDK in your research or projects, please cite it as follows:
239
+
240
+ ```bibtex
241
+ @misc{Ratio1SDK,
242
+ author = {Ratio1.AI},
243
+ title = {Ratio1 SDK},
244
+ year = {2024-2025},
245
+ howpublished = {\url{https://github.com/NaeuralEdgeProtocol/naeural_client}},
246
+ }
247
+ ```
248
+
249
+ ```bibtex
250
+ @misc{Ratio1EdgeNode,
251
+ author = {Ratio1.AI},
252
+ title = {Ratio1: Edge Node},
253
+ year = {2024-2025},
254
+ howpublished = {\url{https://github.com/NaeuralEdgeProtocol/edge_node}},
255
+ }
256
+ ```
@@ -1,4 +1,4 @@
1
- __VER__ = "2.6.14"
1
+ __VER__ = "2.6.16"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd: