[web] Add PythonExecutionContext with per-file output buffers (#32737)

* [web] extract PythonExecutionContext and PythonRunner to manage pyodide execution per file

* [web] define worker URL in python execution context in order to avoid breaking cjs-based tests

* [web] use null check for doc contents to allow running empty python files

* [web] flush buffered editor ops before refreshing snapshot for python execution

* [web] catch getExecutionContext errors in python runner to prevent unhandled rejections

* [web] add PythonRunner unit tests and extract shared WorkerMock

* refactor: rename snapshot to state in PythonRunner

* fix: remove unnecessary path normalization in PythonExecutionProvider

* fix cypress tests

GitOrigin-RevId: 9c55586d982fe8df5b90374227005c6b83e94d1f
This commit is contained in:
Domagoj Kriskovic
2026-04-21 08:05:50 +00:00
committed by Copybot
parent e30a2a5beb
commit 415db24ba4
13 changed files with 938 additions and 345 deletions
@@ -2,26 +2,29 @@ import { Panel, PanelGroup } from 'react-resizable-panels'
import { VerticalResizeHandle } from '@/features/ide-react/components/resize/vertical-resize-handle'
import PythonOutputPane from '@/features/ide-react/components/editor/python/python-output-pane'
import SourceEditor from '@/features/source-editor/components/source-editor'
import { PythonExecutionProvider } from '@/features/ide-react/context/python-execution-context'
export const PythonEditorSplit = () => {
return (
<PanelGroup
autoSaveId="ide-redesign-editor-python-output"
direction="vertical"
className="ide-redesign-python-editor-split"
>
<Panel id="ide-redesign-panel-source-editor-content" order={1}>
<SourceEditor />
</Panel>
<VerticalResizeHandle id="ide-redesign-editor-python-output" />
<Panel
id="ide-redesign-panel-python-output"
order={2}
defaultSize={35}
minSize={10}
<PythonExecutionProvider>
<PanelGroup
autoSaveId="ide-redesign-editor-python-output"
direction="vertical"
className="ide-redesign-python-editor-split"
>
<PythonOutputPane />
</Panel>
</PanelGroup>
<Panel id="ide-redesign-panel-source-editor-content" order={1}>
<SourceEditor />
</Panel>
<VerticalResizeHandle id="ide-redesign-editor-python-output" />
<Panel
id="ide-redesign-panel-python-output"
order={2}
defaultSize={35}
minSize={10}
>
<PythonOutputPane />
</Panel>
</PanelGroup>
</PythonExecutionProvider>
)
}