setta 0.0.3.dev14__py3-none-any.whl → 0.0.4__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.3.dev14"
1
+ __version__ = "0.0.4"
@@ -1,3 +1,5 @@
1
+ import asyncio
2
+
1
3
  import black
2
4
  from fastapi import APIRouter, Depends
3
5
  from pydantic import BaseModel
@@ -39,12 +41,17 @@ async def route_update_interactive_code(
39
41
  tasks=Depends(get_tasks),
40
42
  lsp_writers=Depends(get_lsp_writers),
41
43
  ):
42
- idx = 0
43
- content = []
44
- for p in x.projects:
45
- initialContent = await update_interactive_code(p, tasks, lsp_writers, idx)
46
- content.extend(initialContent)
47
- idx += 1
44
+ # Create list of coroutines to run in parallel
45
+ update_tasks = [
46
+ update_interactive_code(p, tasks, lsp_writers, idx)
47
+ for idx, p in enumerate(x.projects)
48
+ ]
49
+
50
+ # Run all updates in parallel and gather results
51
+ all_content = await asyncio.gather(*update_tasks)
52
+
53
+ # Flatten the list of content
54
+ content = [item for sublist in all_content for item in sublist]
48
55
 
49
56
  inMemorySubprocessInfo = tasks.getInMemorySubprocessInfo()
50
57
  return {"inMemorySubprocessInfo": inMemorySubprocessInfo, "content": content}
@@ -75,20 +82,34 @@ async def update_interactive_code(p, tasks, lsp_writers, idx):
75
82
  template_var_replacement_values=template_var_replacement_values,
76
83
  )
77
84
 
85
+ runCodeBlocks = p["runCodeBlocks"]
86
+ if runCodeBlocks is None:
87
+ runCodeBlocks = [
88
+ k for k in p["sections"].keys() if get_section_type(p, k) == C.CODE
89
+ ]
90
+
78
91
  top_node_ids, section_dependencies = prune_and_find_top_nodes(
79
- code_dict, p["runCodeBlocks"]
92
+ code_dict, runCodeBlocks
80
93
  )
81
94
  code_graph = []
82
95
  project_config_id = p["projectConfig"]["id"]
83
96
  for section_id in top_node_ids:
97
+ import_order = get_import_order_for_top_node(section_id, section_dependencies)
98
+ imports = [
99
+ {
100
+ "code": code_dict[s]["code"],
101
+ "module_name": create_in_memory_module_name(p, s),
102
+ }
103
+ for s in import_order
104
+ ]
105
+
84
106
  code_graph.append(
85
107
  {
108
+ "imports": imports,
86
109
  "subprocess_key": f"{project_config_id}-{section_id}-{idx}",
87
- "code": code_dict[section_id]["code"],
88
- "imports": get_import_order_for_top_node(
89
- section_id, section_dependencies
90
- ),
91
- "module_name": create_in_memory_module_name(p, section_id),
110
+ "subprocessStartMethod": p["sections"][section_id][
111
+ "subprocessStartMethod"
112
+ ],
92
113
  }
93
114
  )
94
115
 
@@ -58,7 +58,7 @@
58
58
  "gridPattern": "Dots",
59
59
  "gridPatternSize": 2,
60
60
  "gridColor": "#afbacf",
61
- "gridColorDarkMode": "#222a3a",
61
+ "gridColorDarkMode": "#2b364a",
62
62
  "defaultZoomLevel": 1,
63
63
  "minZoom": 0.1,
64
64
  "maxZoom": 10,
@@ -64,7 +64,8 @@
64
64
  "aspectRatioExtraHeight": 0,
65
65
  "aspectRatioExtraWidth": 0,
66
66
  "columnWidth": null,
67
- "renderedValue": null
67
+ "renderedValue": null,
68
+ "subprocessStartMethod": "fork"
68
69
  },
69
70
  "sectionVariant": {
70
71
  "name": "",