fix(export): allow WebPDF export on Windows#10131
Merged
mscolnick merged 4 commits intoJul 10, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Architecture diagram
sequenceDiagram
participant User
participant CLI as CLI (commands.py)
participant FileWatcher as File Watcher
participant ExportManager as Exporter (exporter.py)
participant EventLoop as Event Loop Policy
participant nbconvert as nbconvert WebPDFExporter
participant Playwright as Playwright / Subprocess
Note over User,ExportManager: Watch-mode WebPDF export flow (Windows fix)
User->>CLI: marimo export --watch --webpdf
CLI->>FileWatcher: start watching notebook file
Note over FileWatcher,CLI: File change detected
FileWatcher-->>CLI: on_file_changed(path)
CLI->>CLI: acquire export_lock (async)
CLI->>ExportManager: export_callback(MarimoPath)
Note over ExportManager: export_as_pdf(webpdf=True)
ExportManager->>ExportManager: check sys.platform == "win32" and webpdf
alt On Windows (Win32)
ExportManager->>EventLoop: get_event_loop_policy()
EventLoop-->>ExportManager: previous_policy (WindowsSelector...)
ExportManager->>EventLoop: set_event_loop_policy(None)
Note over ExportManager: Reset to default ProactorEventLoop
ExportManager->>nbconvert: from_notebook_node(notebook)
nbconvert->>Playwright: spawn chromium subprocess
Playwright-->>nbconvert: PDF data
nbconvert-->>ExportManager: pdf_data, resources
ExportManager->>EventLoop: set_event_loop_policy(previous_policy)
Note over ExportManager: Restore original selector policy
else Non-Windows (or not webpdf)
ExportManager->>nbconvert: from_notebook_node(notebook)
nbconvert-->>ExportManager: pdf_data, resources
end
ExportManager-->>CLI: bytes PDF data
CLI->>CLI: release export_lock
CLI-->>User: PDF written to output file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
peter-gy
marked this pull request as ready for review
July 10, 2026 08:24
mscolnick
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebPDF export launches Chromium as a child process. On Windows, marimo uses an async event loop that can monitor notebook connections but cannot launch child processes, so
nbconvertfails before Chromium renders the notebook.This PR renders WebPDF in a separate Windows process. The renderer uses the Proactor event loop to start Chromium, while the marimo server keeps the event loop it needs for notebook connections.
Fixes #9713