Skip to content

[http-client-python] Bundle playground dependency wheels without Pyodide CDN access - #12590

Closed
Libba Lawrence (l0lawrence) wants to merge 6 commits into
microsoft:mainfrom
l0lawrence:l0lawrence-python-playground-bundle-fix
Closed

Libba Lawrence (l0lawrence) wants to merge 6 commits into
microsoft:mainfrom
l0lawrence:l0lawrence-python-playground-bundle-fix

Conversation

@l0lawrence

@l0lawrence Libba Lawrence (l0lawrence) commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Reapplies #12484 (reverted in #12577) with a fix for the release pipeline failure.

Root cause

ADO run 7073634 failed in Build emitter for playground bundle. build_browser_wheels() downloaded Pyodide metadata and the PyYAML/MarkupSafe wasm wheels from cdn.jsdelivr.net. The 1ES network-isolation proxy rejected that host with 403 Tunnel connection failed. The playground step runs before PublishNpm, so it also blocked npm publishing.

Fix

  • Read pyodide-lock.json from the pinned Pyodide npm package, installed using the configured Azure SDK for JS feed.
  • Fetch pinned Python dependencies from the configured Python feed, with pip --require-hashes and the lock in eng/playground-requirements.txt. No dependency wheel binaries are checked into the current tree.
  • Build pure-Python PyYAML and MarkupSafe wheels from their hash-verified source distributions. These avoid downloading the Pyodide-specific native wheels. MarkupSafe uses its upstream setup.cfg metadata without its optional native extension.
  • Reject non-universal wheels and native binaries, and run pip's offline dependency resolver against the complete bundle before publishing. The browser loads all Python wheels from emitter assets; the Pyodide runtime itself still loads from jsDelivr in the browser.

The earlier draft commit containing wheel binaries remains in the branch history, but the current tree and PR diff remove them.

Validation

  • Python unit tests: 8 passed; emitter vitest: 75 passed; TypeScript typecheck passed.
  • npm run build:playground succeeded with package caching disabled behind a proxy that blocks cdn.jsdelivr.net; the proxy observed only the Azure package feed and its storage hosts. The manifest contains 14 wheels, including pure-Python PyYAML and MarkupSafe.
  • With external network blocked in local Pyodide 0.26.2, all bundled wheels loaded, YAML parsing and HTML escaping worked, and a Python operation was generated and compiled.
  • The network-isolated ADO publish pipeline has not yet been verified.

… access

Reapply microsoft#12484 (reverted in microsoft#12577). The playground build now reads
pyodide-lock.json from the pinned pyodide npm dependency and resolves
PyYAML/MarkupSafe via metadata-only placeholder wheels, so it never
contacts cdn.jsdelivr.net, which the isolated release pipeline blocks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Nov 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@12590

commit: 853fddd

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Fix playground generation by bundling the generator's Python dependencies with the emitter instead of resolving them from PyPI in the browser. The playground build obtains hash-pinned dependencies from the configured Python feed and builds pure-Python PyYAML and MarkupSafe wheels without downloading from the Pyodide CDN. Update the generator's PyYAML dependency to 6.0.3.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:4a6bebe511b680938e26929a03250d35bff66cb4 vs this PR.

No changes to generated output.

Rendered diff: inline on the run summary, or the emitter-diff-html artifact.

Informational check (eng/emitter-diff); does not block the PR.

@azure-sdk-automation

azure-sdk-automation Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Bundle all Pyodide dependency wheels, including PyYAML and MarkupSafe wasm builds, so the playground build performs no package downloads in the network-isolated release pipeline and the browser loads every package from emitter assets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace checked-in wheels with hash-pinned feed artifacts and build pure-Python PyYAML and MarkupSafe for the browser.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant