Skip to content

[http-client-python] Fix playground generation with bundled dependency wheels - #12484

Merged
Libba Lawrence (l0lawrence) merged 9 commits into
microsoft:mainfrom
l0lawrence:l0lawrence-python-playground-emitter
Nov 6, 2026
Merged

Libba Lawrence (l0lawrence) merged 9 commits into
microsoft:mainfrom
l0lawrence:l0lawrence-python-playground-emitter

Conversation

@l0lawrence

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

Copy link
Copy Markdown
Member

Fix Python playground Failed to fetch errors by publishing dependencies with the emitter instead of resolving them from PyPI in the browser.

  • Prepare browser-compatible wheels from CFS only for playground publication; ordinary builds skip this step.
  • Install public wheel assets and matching Pyodide packages without package-index lookups. Generation stays in the browser, with no company-network access required.

** When running the script for the playground we pull the dependencies down from the CFS feed and bundle them. Non-playground uses of the emitter should not be impacted. We pull all dependencies of the emitter with the exception of pyYAML and MarkupSafe which are vendored by pyodide already

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 3, 2026
@azure-sdk-automation

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

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Fixes TypeSpec playground Python SDK generation by bundling browser-compatible dependency wheels and avoiding runtime PyPI/package-index resolution failures.

Changes:

  • Add a dedicated build:playground path that resolves and publishes pure-Python wheels + a manifest at build time.
  • Harden/standardize package-manager detection and venv bootstrapping with pinned/minimum pip/uv versions.
  • Add unit + emitter tests and documentation describing the new browser wheel/manifest flow.
File Description
packages/​http-client-python/​tests/​unit/​test_package_manager.py Adds unit coverage for package-manager version floors and pip bootstrapping behavior.
packages/​http-client-python/​tests/​unit/​test_browser_wheels.py Adds unit coverage for building/publishing the browser wheel manifest and pure wheels.
packages/​http-client-python/​package.json Adds build:playground script and includes browser wheel assets + manifest in published files.
packages/​http-client-python/​eng/​scripts/​setup/​package_manager.py Enforces minimum versions, pins pip, and changes venv bootstrapping/install command behavior.
packages/​http-client-python/​eng/​scripts/​setup/​build_pygen_wheel.py Implements build-time browser wheel resolution + manifest generation; adds --playground CLI flag.
packages/​http-client-python/​eng/​scripts/​setup/​build.ts Forwards CLI args to the Python wheel builder (enables --playground).
packages/​http-client-python/​eng/​pipeline/​publish.yml Wires playground publication to use build:playground.
packages/​http-client-python/​emitter/​test/​browser-pyodide.test.ts Adds emitter test ensuring browser installs bundled wheels without index queries + manifest error cases.
packages/​http-client-python/​emitter/​src/​emitter.ts Loads manifest + bundled wheels in browser; installs with deps: false and loads native deps via Pyodide.
packages/​http-client-python/​emitter/​src/​constants.ts Uses package.json as the single Pyodide-version source.
packages/​http-client-python/​ARCHITECTURE.md Documents the new browser runtime behavior and build-time resolution constraints.
.chronus/​changes/​python-playground-browser-wheels.md Adds changelog entry for the playground/browser-wheels fix and package-manager floors.

Review effort: Lite

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

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

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

Fix Python playground generation when package downloads are blocked on corporate networks. Publish browser-compatible dependency wheels with the emitter instead of querying PyPI or CFS at runtime. Prepare these assets only for playground builds.

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 43f4c91

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

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:3a87c089009146e1ce1201659c00f1179411a81f 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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove unrelated installer hardening and CI provisioning changes, and retain the existing Pyodide and PyYAML versions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pass native wheel URLs and the compatibility pin directly to pip instead of generating constraints and find-links arguments.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uv path creates an environment without pip, causing wheel downloads to fail with No module named pip and blocking build:playground.

1 open issue
3 resolved since last review

Review effort: Balanced

Provision pinned pip through the selected package manager only for playground builds and cover uv bootstrap ordering.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain in the playground dependency-loading changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@l0lawrence
Libba Lawrence (l0lawrence) added this pull request to the merge queue Nov 6, 2026
Merged via the queue into microsoft:main with commit 86796f2 Nov 6, 2026
37 checks passed
@l0lawrence
Libba Lawrence (l0lawrence) deleted the l0lawrence-python-playground-emitter branch November 6, 2026 20:12
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 eng

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants