setta 0.0.14.dev0__py3-none-any.whl → 0.0.14.dev2__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.
@@ -14,8 +14,8 @@
14
14
  <meta name="description" content="setta" />
15
15
 
16
16
  <title>setta.dev</title>
17
- <script type="module" crossorigin src="/static/assets/index-eTf7hTS7.js"></script>
18
- <link rel="stylesheet" crossorigin href="/static/assets/index-xJaZMJy2.css">
17
+ <script type="module" crossorigin src="/static/assets/index-B_D80dlv.js"></script>
18
+ <link rel="stylesheet" crossorigin href="/static/assets/index-DQjclEVk.css">
19
19
  </head>
20
20
  <body>
21
21
  <noscript>You need to enable JavaScript to run this app.</noscript>
setta/tasks/tasks.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import copy
3
+ import json
3
4
  import logging
4
5
  import time
5
6
  from typing import Dict
@@ -64,13 +65,21 @@ class Tasks:
64
65
  websocket_manager=None,
65
66
  call_all=False,
66
67
  subprocess_key=None,
68
+ project_config_id=None,
69
+ section_id=None,
70
+ idx=None,
71
+ call_type="call",
72
+ other_data=None,
67
73
  ):
68
74
  # Create a list of tasks to run concurrently
69
75
  tasks = []
70
76
  results = []
77
+ message.content = {tuple(json.loads(k)): v for k, v in message.content.items()}
71
78
 
72
79
  for sp_key, sp_info in self.in_memory_subprocesses.items():
73
- if subprocess_key and sp_key != subprocess_key:
80
+ if (subprocess_key and sp_key != subprocess_key) or (
81
+ not match_subprocess_key(sp_key, project_config_id, section_id, idx)
82
+ ):
74
83
  continue
75
84
  for fn_name, fnInfo in sp_info["fnInfo"].items():
76
85
  if (
@@ -80,7 +89,12 @@ class Tasks:
80
89
  ):
81
90
  # Send message to subprocess
82
91
  sp_info["subprocess"].parent_conn.send(
83
- {"type": "call", "fn_name": fn_name, "message": message}
92
+ {
93
+ "type": call_type,
94
+ "fn_name": fn_name,
95
+ "message": message,
96
+ "other_data": other_data,
97
+ }
84
98
  )
85
99
 
86
100
  # Create task for receiving response
@@ -131,7 +145,7 @@ class Tasks:
131
145
  else:
132
146
  results.append(result)
133
147
 
134
- async def add_custom_fns(self, code_graph, to_cache):
148
+ async def add_custom_fns(self, code_graph, exporter_obj):
135
149
  for c in code_graph:
136
150
  subprocess_key = c["subprocess_key"]
137
151
  sp = self.in_memory_subprocesses.get(subprocess_key, {}).get("subprocess")
@@ -149,7 +163,7 @@ class Tasks:
149
163
  {
150
164
  "type": "import",
151
165
  "imports": c["imports"],
152
- "to_cache": to_cache,
166
+ "exporter_obj": exporter_obj,
153
167
  }
154
168
  )
155
169
  result = await self.task_runner.run(sp.parent_conn.recv, [], RunType.THREAD)
@@ -181,6 +195,20 @@ class Tasks:
181
195
 
182
196
  return initial_result["content"]
183
197
 
198
+ async def call_in_memory_subprocess_fn_with_new_exporter_obj(
199
+ self, project_config_id, idx, exporter_obj
200
+ ):
201
+ initial_result = await self.call_in_memory_subprocess_fn(
202
+ TaskMessage(id=create_new_id(), content={}),
203
+ call_all=True,
204
+ project_config_id=project_config_id,
205
+ idx=idx,
206
+ call_type="call_with_new_exporter_obj",
207
+ other_data={"exporter_obj": exporter_obj},
208
+ )
209
+
210
+ return initial_result["content"]
211
+
184
212
  def close(self):
185
213
  self.stop_event.set()
186
214
  for v in self.in_memory_subprocesses.values():
@@ -217,3 +245,32 @@ class Tasks:
217
245
  for fnInfo in output[sp_key]["fnInfo"].values():
218
246
  fnInfo["dependencies"] = list(fnInfo["dependencies"])
219
247
  return output
248
+
249
+
250
+ def construct_subprocess_key(project_config_id, section_id, idx):
251
+ return f"{project_config_id}_{section_id}_{idx}"
252
+
253
+
254
+ def match_subprocess_key(
255
+ subprocess_key, project_config_id=None, section_id=None, idx=None
256
+ ):
257
+ # If no filters are provided, return True
258
+ if project_config_id is None and section_id is None and idx is None:
259
+ return True
260
+
261
+ # Split the key into its components
262
+ parts = subprocess_key.split("_")
263
+ if len(parts) != 3:
264
+ return False
265
+
266
+ key_project_config_id, key_section_id, key_idx_str = parts
267
+
268
+ # Check if the extracted values match the provided filters
269
+ if project_config_id is not None and key_project_config_id != project_config_id:
270
+ return False
271
+ if section_id is not None and key_section_id != section_id:
272
+ return False
273
+ if idx is not None and key_idx_str != str(idx):
274
+ return False
275
+
276
+ return True
setta/tasks/utils.py CHANGED
@@ -1,6 +1,5 @@
1
1
  import asyncio
2
2
  import importlib.util
3
- import json
4
3
  import logging
5
4
  import multiprocessing
6
5
  import queue
@@ -109,7 +108,7 @@ class SettaInMemoryFnSubprocess:
109
108
  fns_dict, module, module_name
110
109
  )
111
110
  for k in added_fn_names:
112
- cache[k] = msg["to_cache"]
111
+ cache[k] = msg["exporter_obj"]
113
112
  dependencies[k] = get_task_metadata(fns_dict[k], cache[k])
114
113
 
115
114
  self.child_conn.send(
@@ -120,12 +119,23 @@ class SettaInMemoryFnSubprocess:
120
119
  )
121
120
 
122
121
  elif msg_type == "call":
123
- fn_name = msg["fn_name"]
124
- message = self.process_message(fn_name, msg["message"], cache)
125
- fn = fns_dict[fn_name]
126
- result = fn.fn(message)
127
- return_message_type = fn.return_message_type
122
+ result, return_message_type = self.call_imported_fn(
123
+ msg, fns_dict, cache
124
+ )
125
+ self.child_conn.send(
126
+ {
127
+ "status": "success",
128
+ "content": result,
129
+ "messageType": return_message_type,
130
+ }
131
+ )
128
132
 
133
+ elif msg_type == "call_with_new_exporter_obj":
134
+ # replace old exporter_obj
135
+ cache[msg["fn_name"]] = msg["other_data"]["exporter_obj"]
136
+ result, return_message_type = self.call_imported_fn(
137
+ msg, fns_dict, cache
138
+ )
129
139
  self.child_conn.send(
130
140
  {
131
141
  "status": "success",
@@ -144,6 +154,14 @@ class SettaInMemoryFnSubprocess:
144
154
  }
145
155
  )
146
156
 
157
+ def call_imported_fn(self, msg, fns_dict, cache):
158
+ fn_name = msg["fn_name"]
159
+ message = self.process_message(fn_name, msg["message"], cache)
160
+ fn = fns_dict[fn_name]
161
+ result = fn.fn(message)
162
+ return_message_type = fn.return_message_type
163
+ return result, return_message_type
164
+
147
165
  def close(self):
148
166
  try:
149
167
  logger.debug("Initiating shutdown sequence")
@@ -181,7 +199,9 @@ class SettaInMemoryFnSubprocess:
181
199
  if fn_name in cache:
182
200
  exporter_obj = cache[fn_name]
183
201
  for k, v in message.content.items():
184
- nice_str = exporter_obj.var_name_mapping[tuple(json.loads(k))]
202
+ nice_str = exporter_obj.var_name_mapping.get(k)
203
+ if not nice_str:
204
+ continue
185
205
  p_dict, key = nested_access(exporter_obj.output, nice_str)
186
206
  p_dict[key] = v
187
207
  message.content = exporter_obj.output
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: setta
3
- Version: 0.0.14.dev0
3
+ Version: 0.0.14.dev2
4
4
  Summary: Python without the donkeywork.
5
5
  Home-page: https://setta.dev
6
6
  Author: Kevin Musgrave, Jeff Musgrave
@@ -1,4 +1,4 @@
1
- setta/__init__.py,sha256=7x66PyKcSeHdLzcJnPGdwNfarjaZuSqZpNVMvzIQXqk,28
1
+ setta/__init__.py,sha256=v8sPkSKHEFL488Wxp-yVEGsW9I0nkkHNUUO3b_4XqSQ,28
2
2
  setta/server.py,sha256=q4w9WG7SuLxwYtgXUCQyLt7t_HLmQV4y5abqvm7-uEA,4861
3
3
  setta/start.py,sha256=5sMZ7WH3KV9Q0v186PsaYqsWOz7hebyrpXbBOp9wQww,3589
4
4
  setta/cli/__init__.py,sha256=UxZG_VOMuF6lEBT3teUgTS9ulsK3wt3Gu3BbAQiAmt8,47
@@ -88,7 +88,7 @@ setta/routers/artifact.py,sha256=9wHdreg5DsLshhET-6gEDw2Apw_-r8bRF1x3-_dD9mU,266
88
88
  setta/routers/code_info.py,sha256=rDBLkr5VQOlktap3hWA73ls0VrBi5y4mc_SfWzw9ad0,857
89
89
  setta/routers/dependencies.py,sha256=0pz1HuvhlJDIVopvkfRTgmLJhDPGw0g33uj2qXgpxQs,1228
90
90
  setta/routers/in_memory_fn_stdout_websocket.py,sha256=T2BpLzh6PwYQP0qIkFS4r_VfEKBlwl4gkwIaq6r6Phs,604
91
- setta/routers/interactive.py,sha256=mp-A9xFpVw4nDPHiKhz1rnQtO0c6R-tRcLJxl4UHXTA,4912
91
+ setta/routers/interactive.py,sha256=TNXAupBXIuCn711olZPJemFB6WrBKWyy4inHbjNh9aw,5646
92
92
  setta/routers/lsp.py,sha256=DAZqdiRKDWJ9ikjwQetV4_8s9U-EDC91ToJA3u57qnU,385
93
93
  setta/routers/projects.py,sha256=p3zPD3jobYOxBGJSSIYS1Aqu1w-PrJCcEN6dPJ0DT6E,5255
94
94
  setta/routers/reference_renaming.py,sha256=Ec1hz2Nz_hYqk8GyGmUcWKvXo-lVEDbIIK2YbX-wi00,3598
@@ -97,8 +97,8 @@ setta/routers/settings.py,sha256=1S7Epj4O7jElixjNaNlRplBGiYdkj9mFeNQeeOrtQw4,103
97
97
  setta/routers/terminals.py,sha256=91I3tVUPJtLyCD_-E_qBQ_k8uuNUrcXl5P7sCTQuDQE,2435
98
98
  setta/routers/websocket.py,sha256=6fSROv9C5PobPXppUWwNLDDO0p8VADYaf2KcgIuTQp4,1121
99
99
  setta/static/constants/BaseUITypes.json,sha256=WQUgvN4eq9uU6ifhDBhtyEIoQFsAC022DSEut-E-4bA,4057
100
- setta/static/constants/Settings.json,sha256=VJFMO1iq61Euws5QjD5iaBgGh33YRy8GB7MokuEI4IA,3482
101
- setta/static/constants/constants.json,sha256=idIyNVecbvyH-AhirWdxxG9lA8QZZzxIS1061Q1_mJI,5326
100
+ setta/static/constants/Settings.json,sha256=uE9PWakebkxUaLx-UyiplyTFTwVj2ogomgoalNnQSkw,3532
101
+ setta/static/constants/constants.json,sha256=vzBINDWfx-4kbbz-2B8OASzykm9aCqr3yyD2yKoKzWU,5403
102
102
  setta/static/constants/db_init.sql,sha256=rdc0C5Hx_6d-QWEEbSqscArTyc77w9cMj8vbIVS8ZBw,8436
103
103
  setta/static/constants/defaultValues.json,sha256=Vh8WQZJYSc0QBu5WnNQO2dQtuYHZuy3WKfQEr9sBSqE,3063
104
104
  setta/static/constants/settingsProject.json,sha256=3s2PQSBXqV9BYnibKY1xbLZfEYjL6JeLnPVEusfmz9c,14678
@@ -109,7 +109,7 @@ setta/static/frontend/browserconfig.xml,sha256=w0iw1t89kA7-965LTfyLYrFzewTQnUWE_
109
109
  setta/static/frontend/favicon-16x16.png,sha256=q67Crpy8s3wryu7Y3kffPeysN99Lt4XeFygXhPKize8,740
110
110
  setta/static/frontend/favicon-32x32.png,sha256=4NKXYticYdMrRHmVveHjxqnBU1HWgBT5JyJG8lx3BNE,1027
111
111
  setta/static/frontend/favicon.ico,sha256=02qhEBLsvsgBTZX6dcZElMyivlvrR7Yr6wB8ItEZFsc,15086
112
- setta/static/frontend/index.html,sha256=kh5NXxuxD9l1QVGAV23Gxhy59MFnyDwyuZT9mGAA3PM,1298
112
+ setta/static/frontend/index.html,sha256=F8-JCfCuTlOXXGmwFhCc7p-pGOdqZlgKLzupLNCSxHc,1298
113
113
  setta/static/frontend/manifest.json,sha256=ULPYw5A68_eNhxuUVXqxT045yhkurKPSz6hjyGcnmhQ,492
114
114
  setta/static/frontend/mstile-144x144.png,sha256=wQqckmRWre2NCCevevI3rv4j0tcduVMkpYr2tPj73cs,2692
115
115
  setta/static/frontend/mstile-150x150.png,sha256=FUwy6PipTofnhmJB5CdXWYgwy-2inq_sIOdOwdDklcY,2674
@@ -184,8 +184,8 @@ setta/static/frontend/assets/cormorant-garamond-cyrillic-ext-700-italic-gsr366qd
184
184
  setta/static/frontend/assets/cormorant-garamond-latin-700-italic-BQbwEFjx.woff2,sha256=C8U-EgDBT8MpU4FpUNBJdybVpKvRhg_3WDpUDCw9XZg,20348
185
185
  setta/static/frontend/assets/cormorant-garamond-latin-ext-700-italic-DnnS5iSC.woff2,sha256=Ulc44CPXdUiI5dY86W76HLk7801Fm9_QywCV-8GRtFU,17240
186
186
  setta/static/frontend/assets/cormorant-garamond-vietnamese-700-italic-2_nTgjbG.woff2,sha256=mVYwN54qI0RLXqyrDGPUNpBHWSJDKjgUyBRWa2FJ_ao,5248
187
- setta/static/frontend/assets/index-eTf7hTS7.js,sha256=uQTogsAO25h0MVP-r_v0uUbuTVTqRb9jGfsEAqF0qaA,3080551
188
- setta/static/frontend/assets/index-xJaZMJy2.css,sha256=GYtWBugj7xeHa-wj2KanVfLDnK6kxFimUj3Gcr8FvGU,237888
187
+ setta/static/frontend/assets/index-B_D80dlv.js,sha256=FMJmhUHbA3QfKJ_EU9UzcSwxZw9KI5X3WirWAfrtBUE,3082364
188
+ setta/static/frontend/assets/index-DQjclEVk.css,sha256=uIx7VJi9TIDdzOMllLQNKxOMTytUkdRv9LVJyiB190g,238315
189
189
  setta/static/frontend/assets/inter-all-400-normal-ByZ5TkcW.woff,sha256=BU8S0GmcIMyYte4ESEdQJO-WvL2Rb-38m1n0ujdbYxI,128624
190
190
  setta/static/frontend/assets/inter-all-600-normal-BQl_S1BW.woff,sha256=wDdp5VNyQL_IbxcPThD2qI-ETg_QKj7AmCwMCjqDfLE,139072
191
191
  setta/static/frontend/assets/inter-all-800-normal-BdAoPad8.woff,sha256=FdxuS9xuVumB5nbVcCXyt3IWqzS4Z75qiRz_0FV5al0,139120
@@ -230,8 +230,8 @@ setta/static/seed/.DS_Store,sha256=ENxJvDQd7Te_U8gExcXtHE-mAeBUYOHELRfDWgN1NmA,6
230
230
  setta/static/seed/examples/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
231
231
  setta/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
232
232
  setta/tasks/task_runner.py,sha256=gMXpfZWFMQbix2MfrHVCKB7BxQCjO8JH2P8cxUmt1ms,849
233
- setta/tasks/tasks.py,sha256=CuL-JslPrD1nghaO9SgQq3CkpPhmXDAPGUldZa5Qv5Q,8231
234
- setta/tasks/utils.py,sha256=Ak9XbGMcYBLmu0hl4eB9pyLYzvdCu8FDSK-USUOtFS4,9810
233
+ setta/tasks/tasks.py,sha256=kgV1Z0xzM9dBS5nreO8QYGPLG-njR-zZ5-viT2rYpwg,10141
234
+ setta/tasks/utils.py,sha256=iqbsLYBcu4Qd-MAHd0SWK9wPaJezgEh1Yg5YC9goOLU,10631
235
235
  setta/tasks/fns/__init__.py,sha256=JhGzzQGaT9BWtF3pOmguh6pzIF9kdG3jdDNLyYZ2w7g,461
236
236
  setta/tasks/fns/codeAreaAutocomplete.py,sha256=gJ5JbjkWDyTothr-UF-YlOxrbVzj2iyOVK7XD3lfhSQ,6416
237
237
  setta/tasks/fns/codeAreaFindTemplateVars.py,sha256=vD9rY8VNPavv6VKa1bnxRPPRDNvFQy6mPIZRl-_3GnY,3708
@@ -252,9 +252,9 @@ setta/utils/generate_new_filename.py,sha256=KBLX6paDmTvXR-027TpqQkfijIXc7mCfhen-
252
252
  setta/utils/section_contents.py,sha256=V2HQPik6DfSXw4j7IalbP5AZ3OEGCbtL5ub3xL-Q_Qo,4141
253
253
  setta/utils/utils.py,sha256=KjzcvgM3Ab3IcE8vaWYtgBpwzPLKg0LmblnHLoYZJHM,9164
254
254
  setta/utils/websocket_manager.py,sha256=MBIMI8xxOFQF4lT3on4pupi1ttEWXdWPV4fI2YP_UJU,3925
255
- setta-0.0.14.dev0.dist-info/LICENSE,sha256=us9fuCq9wmiZVzayjKxNZ2iJYF6dROe0Qp57ToCO7XU,11361
256
- setta-0.0.14.dev0.dist-info/METADATA,sha256=rUqRdmNKijY3MgL1XcB-xGuEvSxyAZPY_qIsh4odYtE,7517
257
- setta-0.0.14.dev0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
258
- setta-0.0.14.dev0.dist-info/entry_points.txt,sha256=P0qCESy9fWF2q1EQ9JufGldCSnPHplDPn8J6Bgk5hB0,42
259
- setta-0.0.14.dev0.dist-info/top_level.txt,sha256=8G4lmRzVOnJ11_DescPVHE6MQZH-o06A0nGsDDV2ngY,6
260
- setta-0.0.14.dev0.dist-info/RECORD,,
255
+ setta-0.0.14.dev2.dist-info/LICENSE,sha256=us9fuCq9wmiZVzayjKxNZ2iJYF6dROe0Qp57ToCO7XU,11361
256
+ setta-0.0.14.dev2.dist-info/METADATA,sha256=ySjZVaCLgQKmWfS0edY3UcYcrPWaAqJeubY07dtRsNc,7517
257
+ setta-0.0.14.dev2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
258
+ setta-0.0.14.dev2.dist-info/entry_points.txt,sha256=P0qCESy9fWF2q1EQ9JufGldCSnPHplDPn8J6Bgk5hB0,42
259
+ setta-0.0.14.dev2.dist-info/top_level.txt,sha256=8G4lmRzVOnJ11_DescPVHE6MQZH-o06A0nGsDDV2ngY,6
260
+ setta-0.0.14.dev2.dist-info/RECORD,,