feat(export): install server requirements - #10473
Open
peter-gy wants to merge 1 commit into
Open
Conversation
Install the packages and setup requirements owned by an export format, then return refreshed server availability.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Coverage Report for ./frontend
File CoverageNo changed files found. |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Architecture diagram
sequenceDiagram
participant Client as Export Dialog (Client)
participant API as Export API Endpoint
participant Util as Server Utils
participant UV as UvPackageManager
participant Pip as PipPackageManager
participant Deps as Export Dependencies
participant Sub as subprocess
Note over Client,Sub: NEW: Install Export Requirements Flow
Client->>API: POST /api/export/requirements/install {format: "pdf"}
API->>API: enforce_consumer_capability("edit")
API->>Deps: _get_export_format_availability("pdf")
Deps->>Deps: get_missing_export_packages()
Deps->>Deps: get_missing_export_setup()
Deps-->>API: {missing_packages: ["nbconvert[webpdf]"], missing_setup: [...]}
alt Missing packages exist
API->>Util: install_packages_on_server({"nbconvert[webpdf]": ""})
Note over Util: Try uv first, then pip
Util->>UV: is_manager_installed()
alt uv available
UV-->>Util: True
Util->>UV: install("nbconvert[webpdf]", version=None)
UV->>UV: _install_with_cache_fallback()
Note over UV: Runs via asyncio.to_thread to avoid blocking event loop
UV-->>Util: True
else uv not available
UV-->>Util: False
Util->>Pip: is_manager_installed()
Pip-->>Util: True
Util->>Pip: install("nbconvert[webpdf]", version=None)
Pip-->>Util: True
end
Util-->>API: Success
API->>Deps: _get_export_format_availability("pdf")
Deps-->>API: {missing_packages: [], missing_setup: [{"name": "playwright-chromium"}]}
end
alt Missing setup exists
API->>Deps: install_export_setup("playwright-chromium")
Deps->>Sub: subprocess.run([python, -m, playwright, install, chromium])
Note over Deps,Sub: Runs via asyncio.to_thread with 600s timeout
Sub-->>Deps: CompletedProcess(returncode=0)
Deps-->>API: Success
end
API->>Deps: _get_export_availability()
Deps-->>API: {"formats": [{"format":"html",...}, {"format":"pdf","dependenciesAvailable":true},...]}
alt Target format still unresolved
API-->>Client: 500 SERVER_ERROR
else All requirements resolved
API-->>Client: 200 ExportAvailabilityResponse
end
Note over Client,Sub: Failure paths
alt Playwright install fails
Deps->>Sub: subprocess.run()
Sub-->>Deps: TimeoutExpired or returncode != 0
Deps->>Deps: raise RuntimeError
Deps-->>API: Error
API-->>Client: 500 SERVER_ERROR
else Package install fails
Util->>Pip: install()
Pip-->>Util: False
Util->>Util: raise RuntimeError
Util-->>API: Error
API-->>Client: 500 SERVER_ERROR
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
peter-gy
marked this pull request as ready for review
August 6, 2026 12:15
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.
Summary
Add a server-owned installation contract for export requirements.
The client sends an export format. The server resolves its missing packages and setup requirements, installs them into the server Python environment, and returns refreshed availability for every server-backed export format.
uvwhen available andpipotherwise.The export dialog consumes this contract in #10471.