setta 0.0.14.dev0__py3-none-any.whl → 0.0.14.dev1__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 setta might be problematic. Click here for more details.

setta/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.0.14.dev0"
1
+ __version__ = "0.0.14.dev1"
@@ -18,6 +18,7 @@ from setta.code_gen.export_selected import (
18
18
  )
19
19
  from setta.code_gen.find_placeholders import parse_template_var
20
20
  from setta.tasks.fns.utils import replace_template_vars_with_random_names
21
+ from setta.tasks.tasks import construct_subprocess_key
21
22
  from setta.utils.constants import C
22
23
  from setta.utils.utils import multireplace
23
24
 
@@ -35,6 +36,22 @@ class FormatCodeRequest(BaseModel):
35
36
  candidateTemplateVars: dict
36
37
 
37
38
 
39
+ @router.post(C.ROUTE_SEND_PROJECT_TO_INTERACTIVE_CODE)
40
+ async def route_send_project_to_interactive_code(
41
+ x: UpdateInteractiveCodeRequest,
42
+ tasks=Depends(get_tasks),
43
+ ):
44
+ to_run = []
45
+ for idx, p in enumerate(x.projects):
46
+ exporter_obj_in_memory = export_for_in_memory_fn(p)
47
+ to_run.append(
48
+ tasks.call_in_memory_subprocess_fn_with_new_exporter_obj(
49
+ p["projectConfig"]["id"], idx, exporter_obj_in_memory
50
+ )
51
+ )
52
+ return await process_returned_content_from_multiple_tasks(tasks, to_run)
53
+
54
+
38
55
  @router.post(C.ROUTE_UPDATE_INTERACTIVE_CODE)
39
56
  async def route_update_interactive_code(
40
57
  x: UpdateInteractiveCodeRequest,
@@ -46,13 +63,12 @@ async def route_update_interactive_code(
46
63
  update_interactive_code(p, tasks, lsp_writers, idx)
47
64
  for idx, p in enumerate(x.projects)
48
65
  ]
66
+ return await process_returned_content_from_multiple_tasks(tasks, update_tasks)
49
67
 
50
- # Run all updates in parallel and gather results
51
- all_content = await asyncio.gather(*update_tasks)
52
68
 
53
- # Flatten the list of content
69
+ async def process_returned_content_from_multiple_tasks(tasks, to_run):
70
+ all_content = await asyncio.gather(*to_run)
54
71
  content = [item for sublist in all_content for item in sublist]
55
-
56
72
  inMemorySubprocessInfo = tasks.getInMemorySubprocessInfo()
57
73
  return {"inMemorySubprocessInfo": inMemorySubprocessInfo, "content": content}
58
74
 
@@ -106,7 +122,9 @@ async def update_interactive_code(p, tasks, lsp_writers, idx):
106
122
  code_graph.append(
107
123
  {
108
124
  "imports": imports,
109
- "subprocess_key": f"{project_config_id}-{section_id}-{idx}",
125
+ "subprocess_key": construct_subprocess_key(
126
+ project_config_id, section_id, idx
127
+ ),
110
128
  "subprocessStartMethod": p["sections"][section_id][
111
129
  "subprocessStartMethod"
112
130
  ],
@@ -115,7 +133,7 @@ async def update_interactive_code(p, tasks, lsp_writers, idx):
115
133
 
116
134
  initialContent = await tasks.add_custom_fns(
117
135
  code_graph,
118
- to_cache=exporter_obj_in_memory,
136
+ exporter_obj=exporter_obj_in_memory,
119
137
  )
120
138
 
121
139
  return initialContent
@@ -42,6 +42,7 @@
42
42
  "showProjectOverviewTabShortcut": "O",
43
43
  "runCodeShortcut": "Mod + Enter",
44
44
  "runAllCodeShortcut": "Mod + Shift + Enter",
45
+ "sendProjectToAllInteractiveCode": "Alt + I",
45
46
  "paramSelect": "Mod + Shift",
46
47
  "formatCode": "Shift + Alt + F",
47
48
  "selectionKeyCode": "Shift",
@@ -70,6 +70,7 @@
70
70
  "ROUTE_SAVE_CODE_INFO": "/codeInfo/save",
71
71
  "ROUTE_COPY_SECTIONS": "/copySections",
72
72
  "ROUTE_UPDATE_INTERACTIVE_CODE": "/updateInteractiveCode",
73
+ "ROUTE_SEND_PROJECT_TO_INTERACTIVE_CODE": "/sendProjectTointeractiveCode",
73
74
  "ROUTE_FORMAT_CODE": "/formatCode",
74
75
  "ROUTE_SEND_ARTIFACT": "/sendArtfiact",
75
76
  "ROUTE_LOAD_ARTIFACTS": "/loadArtifacts",