naeural-client 2.7.23__py3-none-any.whl → 2.7.24__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.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.7.23"
1
+ __VER__ = "2.7.24"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -100,7 +100,7 @@ class GenericSession(BaseDecentrAIObject):
100
100
  root_topic="naeural",
101
101
  local_cache_base_folder=None,
102
102
  local_cache_app_folder='_local_cache',
103
- use_home_folder=False,
103
+ use_home_folder=True,
104
104
  eth_enabled=True,
105
105
  auto_configuration=True,
106
106
  **kwargs
@@ -179,6 +179,11 @@ class GenericSession(BaseDecentrAIObject):
179
179
  auto_configuration : bool, optional
180
180
  If True, the SDK will attempt to complete the dauth process automatically.
181
181
  Defaults to True.
182
+
183
+
184
+ use_home_folder : bool, optional
185
+ If True, the SDK will use the home folder as the base folder for the local cache.
186
+ NOTE: if you need to use development style ./_local_cache, set this to False.
182
187
  """
183
188
 
184
189
  debug = debug or not debug_silent
@@ -818,11 +823,11 @@ class GenericSession(BaseDecentrAIObject):
818
823
  if needs_netconfig:
819
824
  lst_netconfig_request.append(node_addr)
820
825
  # end for each node in network map
826
+ self.P(f"Net mon from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}", color='y')
821
827
  if len(lst_netconfig_request) > 0:
822
828
  self.__request_pipelines_from_net_config_monitor(lst_netconfig_request)
823
829
  # end if needs netconfig
824
830
  nr_peers = sum(self._dct_can_send_to_node.values())
825
- self.P(f"Net mon from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}", color='y')
826
831
  if nr_peers > 0 and not self.__at_least_one_node_peered:
827
832
  self.__at_least_one_node_peered = True
828
833
  self.P(
@@ -2276,7 +2281,11 @@ class GenericSession(BaseDecentrAIObject):
2276
2281
  self.P("Node '{}' did not appear online in {:.1f}s.".format(node, tm() - _start), color='r')
2277
2282
  return found
2278
2283
 
2279
- def wait_for_node_configs(self, node, /, timeout=15, verbose=True, attempt_additional_requests=True):
2284
+ def wait_for_node_configs(
2285
+ self, node, /,
2286
+ timeout=15, verbose=True,
2287
+ attempt_additional_requests=True
2288
+ ):
2280
2289
  """
2281
2290
  Wait for the node to have its configurations loaded.
2282
2291
 
@@ -2295,8 +2304,7 @@ class GenericSession(BaseDecentrAIObject):
2295
2304
  True if the node has its configurations loaded, False otherwise.
2296
2305
  """
2297
2306
 
2298
- if verbose:
2299
- self.P("Waiting for node '{}' to have its configurations loaded...".format(node))
2307
+ self.P("Waiting for node '{}' to have its configurations loaded...".format(node))
2300
2308
 
2301
2309
  _start = tm()
2302
2310
  found = self.check_node_config_received(node)
@@ -2306,8 +2314,7 @@ class GenericSession(BaseDecentrAIObject):
2306
2314
  sleep(0.1)
2307
2315
  found = self.check_node_config_received(node)
2308
2316
  if not found and not additional_request_sent and (tm() - _start) > request_time_thr and attempt_additional_requests:
2309
- if verbose:
2310
- self.P("Re-requesting configurations of node '{}'...".format(node), show=True)
2317
+ self.P("Re-requesting configurations of node '{}'...".format(node), show=True)
2311
2318
  node_addr = self.__get_node_address(node)
2312
2319
  self.__request_pipelines_from_net_config_monitor(node_addr)
2313
2320
  additional_request_sent = True
@@ -36,7 +36,7 @@ EVM_NET_DATA = {
36
36
  EvmNetData.DAUTH_URL_KEY : "https://dauth-devnet.ratio1.ngrok.app/get_auth_data",
37
37
  EvmNetData.DAUTH_ND_ADDR_KEY : "0x9f49fc29366F1C8285d42e7E82cA0bb668B32CeA",
38
38
  EvmNetData.DAUTH_RPC_KEY : "https://base-sepolia.public.blastapi.io",
39
- EvmNetData.EE_GENESIS_EPOCH_DATE_KEY : "2025-01-12 16:00:00",
39
+ EvmNetData.EE_GENESIS_EPOCH_DATE_KEY : "2025-02-12 16:00:00",
40
40
  EvmNetData.EE_EPOCH_INTERVALS_KEY : 1,
41
41
  EvmNetData.EE_EPOCH_INTERVAL_SECONDS_KEY : 3600,
42
42
  EvmNetData.EE_SUPERVISOR_MIN_AVAIL_PRC_KEY : 0.6,
@@ -20,7 +20,10 @@ from pathlib import Path
20
20
 
21
21
  from .tzlocal import get_localzone_name
22
22
 
23
-
23
+ SDK_HOME = ".ratio1"
24
+ SDK_HOME_PREV = [
25
+ ".naeural"
26
+ ]
24
27
 
25
28
  from .._ver import __VER__
26
29
 
@@ -108,6 +111,12 @@ class BaseLogger(object):
108
111
  })
109
112
 
110
113
  self._lock_table_mutex = threading.Lock()
114
+
115
+ if base_folder is None:
116
+ base_folder = self.get_user_folder(as_str=True)
117
+
118
+ if app_folder is None:
119
+ app_folder = "_local_cache"
111
120
 
112
121
  self._base_folder = base_folder
113
122
  self._app_folder = app_folder
@@ -206,6 +215,16 @@ class BaseLogger(object):
206
215
 
207
216
  return
208
217
 
218
+ @staticmethod
219
+ def get_user_folder(as_str=False, include_sdk_home=True):
220
+ """
221
+ Returns the user folder.
222
+ """
223
+ path = Path.home() / SDK_HOME if include_sdk_home else Path.home()
224
+ if as_str:
225
+ return str(path)
226
+ return path
227
+
209
228
  def get_unique_id(self, size=8):
210
229
  """
211
230
  efficient and low-colision function for small unique id generation
@@ -1062,6 +1081,8 @@ class BaseLogger(object):
1062
1081
  json.dump(path_dict, fp, sort_keys=True, indent=4)
1063
1082
  self._add_log("{} error log changed to {}...".format(file_path, self.log_e_file))
1064
1083
  return
1084
+
1085
+
1065
1086
 
1066
1087
  def _get_cloud_base_folder(self, base_folder):
1067
1088
  upper = base_folder.upper()
@@ -1077,8 +1098,28 @@ class BaseLogger(object):
1077
1098
  def reload_config(self):
1078
1099
  self._configure_data_and_dirs(self.config_file, self.config_file_encoding)
1079
1100
  return
1101
+
1102
+ def _maybe_migrate_folder(self):
1103
+ if self.get_user_folder().is_dir():
1104
+ return
1105
+ user_base_folder = self.get_user_folder(as_str=True, include_sdk_home=True)
1106
+ if user_base_folder in self._base_folder:
1107
+ BaseLogger.print_color("Using default user folder. Checking for previous app homes...", color='d')
1108
+ for old_sdk in SDK_HOME_PREV:
1109
+ new_path = self.get_user_folder(as_str=False, include_sdk_home=True)
1110
+ old_path = self.get_user_folder(as_str=False, include_sdk_home=False) / old_sdk
1111
+ if old_path.is_dir():
1112
+ BaseLogger.print_color(f"Found previous app home '{old_path}'. Renaming to '{SDK_HOME}'...", color='d')
1113
+ old_path.rename(new_path)
1114
+ break
1115
+ #endfor
1116
+ #endif
1117
+ return
1118
+
1080
1119
 
1081
1120
  def _configure_data_and_dirs(self, config_file, config_file_encoding=None):
1121
+ self._maybe_migrate_folder()
1122
+
1082
1123
  self.config_file_encoding = config_file_encoding
1083
1124
 
1084
1125
  if self.no_folders_no_save:
@@ -1109,6 +1150,9 @@ class BaseLogger(object):
1109
1150
  BaseLogger.print_color("Loaded config [{}]".format(config_file))
1110
1151
  self.config_file = config_file
1111
1152
  else:
1153
+
1154
+
1155
+
1112
1156
  self.config_data = {
1113
1157
  'BASE_FOLDER' : self._base_folder,
1114
1158
  'APP_FOLDER' : self._app_folder
@@ -1145,7 +1189,7 @@ class BaseLogger(object):
1145
1189
 
1146
1190
  if not os.path.isdir(self._base_folder):
1147
1191
  BaseLogger.print_color(
1148
- f"WARNING! Invalid app base folder '{self._base_folder}'! We create it automatically!",
1192
+ f"WARNING! No application base folder '{self._base_folder}'!",
1149
1193
  color='r'
1150
1194
  )
1151
1195
  #endif
@@ -8,9 +8,11 @@ from datetime import datetime
8
8
  from naeural_client.const.base import BCct, dAuth
9
9
  from naeural_client._ver import __VER__ as version
10
10
 
11
+ from naeural_client.logging.base_logger import SDK_HOME, BaseLogger
12
+
11
13
 
12
14
  CONFIG_FILE = "config"
13
- SDK_HOME = ".naeural"
15
+
14
16
  LOCAL_PEM_PATH = "./_local_cache/_data/" + BCct.DEFAULT_PEM_FILE
15
17
 
16
18
  ENV_TEMPLATE = """
@@ -84,7 +86,7 @@ def get_user_folder():
84
86
  """
85
87
  Returns the user folder.
86
88
  """
87
- return Path.home() / SDK_HOME
89
+ return BaseLogger.get_user_folder(as_str=False, include_sdk_home=True)
88
90
 
89
91
  def get_user_config_file():
90
92
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.23
3
+ Version: 2.7.24
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -1,10 +1,10 @@
1
1
  naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=wFg4OEsc5m3WFmz4POoTwLN28ajs-fbBTFB_q41F3xE,331
2
+ naeural_client/_ver.py,sha256=F2nRwaEx_ZNxxCd3_1xrglV7G0W65jMaiZhBO7n--l8,331
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
6
6
  naeural_client/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
7
- naeural_client/base/generic_session.py,sha256=7yHc3lEE8gZ3O2kGYMktg63fIOWKArgz1lqVeQf0L5w,114952
7
+ naeural_client/base/generic_session.py,sha256=sD8vijOFS8C1RJOBwrlNOFp0S8kWLhtBuWPmWCSvKfU,115164
8
8
  naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
9
9
  naeural_client/base/pipeline.py,sha256=b4BJlqZ4vsGNqYPjJD9Uzrv5G8CVYG_jbND5rh_s8E0,59702
10
10
  naeural_client/base/plugin_template.py,sha256=7YAFaND2iXoZLgtunjYkFf_TBGieFr3VdNLO3vCqzmM,138795
@@ -37,7 +37,7 @@ naeural_client/const/apps.py,sha256=ePBiJXLuPfFOKuw-LJrT9OWbaodU7QApfDurIPNDoB4,
37
37
  naeural_client/const/base.py,sha256=uq1HrxBsrFFiMP0yL0TcDANuxiSPafSx1Yh5ZyxRubE,5633
38
38
  naeural_client/const/comms.py,sha256=La6JXWHexH8CfcBCKyT4fCIoeaoZlcm7KtZ57ab4ZgU,2201
39
39
  naeural_client/const/environment.py,sha256=RpdDhDgB8NgRoFTk28eODigf9y0WcT9lul6mBOD029w,879
40
- naeural_client/const/evm_net.py,sha256=M6ayYHim5i15XyssOXRtkaA6eWmukanxt0mYZzypl8c,2606
40
+ naeural_client/const/evm_net.py,sha256=mOSvsJnir1v_BrmKS51xIy9ddlZnQwlXWenzGXmXMOE,2606
41
41
  naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
42
42
  naeural_client/const/heartbeat.py,sha256=xHZBX_NzHTklwA2_AEKR0SGdlbavMT4nirqjQg8WlTU,2550
43
43
  naeural_client/const/misc.py,sha256=VDCwwpf5bl9ltx9rzT2WPVP8B3mZFRufU1tSS5MO240,413
@@ -60,7 +60,7 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
60
60
  naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
61
61
  naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
62
62
  naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
63
- naeural_client/logging/base_logger.py,sha256=sTdY0IudHyJKluKkJexyR4ZCZvO1XVKwKMjc1LeOL5E,67694
63
+ naeural_client/logging/base_logger.py,sha256=ScFhAaaj0ZIeB_izbZct21sYHnPWNvheQec3bGe5DTU,68946
64
64
  naeural_client/logging/small_logger.py,sha256=m12hCb_H4XifJYYfgCAOUDkcXm-h4pSODnFf277OFVI,2937
65
65
  naeural_client/logging/logger_mixins/__init__.py,sha256=yQO7umlRvz63FeWpi-F9GRmC_MOHcNW6R6pwvZZBy3A,600
66
66
  naeural_client/logging/logger_mixins/class_instance_mixin.py,sha256=xUXE2VZgmrlrSrvw0f6GF1jlTnVLeVkIiG0bhlBfq3o,2741
@@ -82,11 +82,11 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
82
82
  naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
83
83
  naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
84
84
  naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
85
- naeural_client/utils/config.py,sha256=Jn2q0YV3JbLEp1N_j6NzFpb3Btuq_HQiGrSL1GjW4a4,10098
85
+ naeural_client/utils/config.py,sha256=wVY_IdLJ6D-eJYnfsOGUa4eJApxDX2oAqK0FhjPI1DE,10187
86
86
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
87
87
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=GmZwu2JM9_UB2K-4rKB3o0RgWLqM-7Im6HwBnQLXmHI,25312
88
- naeural_client-2.7.23.dist-info/METADATA,sha256=ycmXGJodGgoac60-Bmm0rH5PQMG4yuIg8pFZ_FYCP10,12354
89
- naeural_client-2.7.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
90
- naeural_client-2.7.23.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
91
- naeural_client-2.7.23.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
92
- naeural_client-2.7.23.dist-info/RECORD,,
88
+ naeural_client-2.7.24.dist-info/METADATA,sha256=Y5plq2aSBT0Fu-yLxzVK9K_wCfZ_cCf-iJ1XA_Kh6Wg,12354
89
+ naeural_client-2.7.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
90
+ naeural_client-2.7.24.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
91
+ naeural_client-2.7.24.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
92
+ naeural_client-2.7.24.dist-info/RECORD,,