Skip to content

Add python emitter to azure playground#4486

Draft
JennyPng wants to merge 1 commit into
mainfrom
jennypng-playground-python-emitter
Draft

Add python emitter to azure playground#4486
JennyPng wants to merge 1 commit into
mainfrom
jennypng-playground-python-emitter

Conversation

@JennyPng
Copy link
Copy Markdown
Member

@JennyPng JennyPng commented May 22, 2026

depends on microsoft/typespec#10775

Reason for this change:

  • typespec-python has an inline dependency on http-client-python
  • Making the Python emitter work in the website requires installing the pygen wheel from storage blob
  • The pygen wheel was uploaded to storage blob by the typespec/http-client-python pipeline BUT it gets stamped with an alpha version ? and the pygen url is resolved based on the version in the package.json. So the wheel was uploaded to a url like .../pkgs/@typespec/http-client-python/0.28.3-alpha.20260429.3/generator/dist/pygen-0.1.0-py3-none-any.whl

and the emitter looks for it at:

function getBrowserPygenWheelUrl(): string {
  return `${BLOB_STORAGE_BASE_URL}/${PACKAGE_NAME}/${pkgJson.version}/generator/dist/${PYGEN_WHEEL_FILENAME}`;
}
  • Problem: the typespec-python emitter uploaded from this repo wouldn't stamp the alpha version, meaning the emitter would look for the pygen wheel at a URL which doesn't exist (e.g. http-client-python/0.28.3/generator/...)

Proposed solution here

  • Reupload the pygen wheel from this repo's publish pipeline, which uses the installed inline http-client-python without an alpha version, so that there is a pygen wheel at the URL it loads

@azure-sdk
Copy link
Copy Markdown
Collaborator

No changes needing a change description found.

@github-actions
Copy link
Copy Markdown
Contributor

⚡ Benchmark Results

⚠️ 1 metric(s) regressed above the +5% threshold:

Metric Baseline Current Change
 ↳ emit/@typespec/openapi3/write 🟢 13.8ms 🟢 14.9ms +7.7% 🔴
Full details – comparing ffe6313 vs baseline 7181847
Metric Baseline Current Change
total 🔴 848.4ms 🔴 817.6ms -3.6%
loader 🟢 171.5ms 🟢 168.5ms -1.7%
resolver 🟢 18.3ms 🟢 18.7ms +2.0%
checker 🟡 202.7ms 🟢 193.0ms -4.8%
validation 🟢 42.4ms 🟢 42.2ms -0.4%
 ↳ validation/@azure-tools/typespec-azure-core 🟢 6.8ms 🟢 6.4ms -5.9%
 ↳ validation/@typespec/http 🟢 5.9ms 🟢 5.6ms -5.7%
 ↳ validation/@typespec/rest 🟢 0.6ms 🟢 0.5ms -10.5%
 ↳ validation/@typespec/versioning 🔴 26.7ms 🔴 27.6ms +3.4%
 ↳ validation/compiler 🟢 1.5ms 🟢 1.5ms -0.6%
linter 🟢 142.4ms 🟢 137.2ms -3.6%
 ↳ linter/@azure-tools/typespec-azure-core/auth-required 🟢 0.0ms 🟢 0.0ms -13.6%
 ↳ linter/@azure-tools/typespec-azure-core/bad-record-type 🟢 0.2ms 🟢 0.2ms -14.0%
 ↳ linter/@azure-tools/typespec-azure-core/byos 🟢 6.4ms 🟢 6.1ms -4.7%
 ↳ linter/@azure-tools/typespec-azure-core/casing-style 🟢 0.6ms 🟢 0.6ms -3.2%
 ↳ linter/@azure-tools/typespec-azure-core/composition-over-inheritance 🟢 0.1ms 🟢 0.1ms +8.6%
 ↳ linter/@azure-tools/typespec-azure-core/documentation-required 🟢 0.8ms 🟢 0.8ms -1.8%
 ↳ linter/@azure-tools/typespec-azure-core/friendly-name 🟢 0.6ms 🟢 0.6ms -7.1%
 ↳ linter/@azure-tools/typespec-azure-core/key-visibility-required 🟢 0.2ms 🟢 0.2ms +1.0%
 ↳ linter/@azure-tools/typespec-azure-core/known-encoding 🟢 0.2ms 🟢 0.2ms +5.2%
 ↳ linter/@azure-tools/typespec-azure-core/long-running-polling-operation-required 🟢 0.3ms 🟢 0.3ms -7.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-case-mismatch 🟢 0.2ms 🟢 0.2ms -4.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-closed-literal-union 🟢 0.3ms 🟢 0.2ms -26.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-enum 🟢 0.0ms 🟢 0.0ms -8.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-error-status-codes 🟢 0.1ms 🟢 0.1ms -7.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops 🟢 0.1ms 🟢 0.1ms -10.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-format 🟢 0.5ms 🟢 0.4ms -4.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-generic-numeric 🟢 0.4ms 🟢 0.4ms -7.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-header-explode 🔴 21.3ms 🟡 19.6ms -7.8% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-legacy-usage 🟢 1.0ms 🟢 1.1ms +2.6%
 ↳ linter/@azure-tools/typespec-azure-core/no-multiple-discriminator 🟢 0.1ms 🟢 0.1ms +9.2%
 ↳ linter/@azure-tools/typespec-azure-core/no-nullable 🟢 0.2ms 🟢 0.2ms -2.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-offsetdatetime 🟢 1.2ms 🟢 1.2ms +0.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-openapi 🟢 1.8ms 🟢 1.7ms -3.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-private-usage 🟢 1.9ms 🟢 1.7ms -7.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-query-explode 🔴 20.8ms 🔴 20.3ms -2.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-response-body 🔴 25.2ms 🔴 24.3ms -3.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-rest-library-interfaces 🟢 0.0ms 🟢 0.0ms -16.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch 🟢 5.9ms 🟢 5.6ms -5.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-rpc-path-params 🟢 0.2ms 🟢 0.2ms -6.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-string-discriminator 🟢 0.0ms 🟢 0.0ms -3.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-unknown 🟢 0.2ms 🟢 0.2ms +2.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-unnamed-union 🟢 0.3ms 🟢 0.3ms -3.0%
 ↳ linter/@azure-tools/typespec-azure-core/operation-missing-api-version 🟢 0.2ms 🟢 0.2ms -14.7%
 ↳ linter/@azure-tools/typespec-azure-core/request-body-problem 🟢 0.2ms 🟢 0.2ms -3.3%
 ↳ linter/@azure-tools/typespec-azure-core/require-versioned 🟢 0.0ms 🟢 0.0ms -27.9%
 ↳ linter/@azure-tools/typespec-azure-core/response-schema-problem 🔴 23.8ms 🔴 23.1ms -3.0%
 ↳ linter/@azure-tools/typespec-azure-core/rpc-operation-request-body 🟢 0.3ms 🟢 0.3ms -2.3%
 ↳ linter/@azure-tools/typespec-azure-core/spread-discriminated-model 🟢 0.3ms 🟢 0.2ms -6.8%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-names 🟢 5.5ms 🟢 5.4ms -0.5%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-operations 🟢 0.1ms 🟢 0.1ms -16.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-common-types-version 🟢 4.4ms 🟢 4.4ms -0.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key 🟢 0.1ms 🟢 0.1ms -5.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage 🟢 0.1ms 🟢 0.1ms -7.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes 🟢 5.8ms 🟢 5.6ms -3.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-path-casing-conflicts 🟢 4.9ms 🟢 4.9ms -0.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-record 🟢 0.4ms 🟢 0.3ms -2.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes 🟢 0.5ms 🟢 0.5ms -4.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes 🟢 0.0ms 🟢 0.0ms +1.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment 🟢 0.2ms 🟢 0.2ms -4.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property 🟢 0.1ms 🟢 0.1ms -0.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator 🟢 0.0ms 🟢 0.0ms -8.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb 🟢 0.1ms 🟢 0.1ms -11.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property 🟢 0.1ms 🟢 0.1ms -11.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format 🟢 0.0ms 🟢 0.0ms -14.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars 🟢 0.2ms 🟢 0.2ms +1.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern 🟢 0.0ms 🟢 0.0ms -28.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation 🟢 0.2ms 🟢 0.1ms -7.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response 🟢 5.3ms 🟢 4.9ms -8.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-patch 🟢 0.4ms 🟢 0.3ms -7.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars 🟢 0.2ms 🟢 0.2ms -3.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state 🟢 0.1ms 🟢 0.1ms -2.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels 🟢 0.1ms 🟢 0.1ms -5.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/empty-updateable-properties 🟢 0.1ms 🟢 0.1ms -1.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation 🟢 0.0ms 🟢 0.0ms -4.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/lro-location-header 🟡 15.8ms 🟡 15.4ms -2.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint 🟢 0.0ms 🟢 0.0ms -11.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers 🟢 0.3ms 🟢 0.3ms -4.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-empty-model 🟢 0.1ms 🟢 0.1ms -7.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation 🟢 0.2ms 🟢 0.2ms -4.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-response-body 🔴 22.8ms 🔴 22.6ms -0.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/patch-envelope 🟢 0.1ms 🟢 0.1ms -4.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/resource-name 🟢 0.1ms 🟢 0.1ms -5.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/secret-prop 🟢 2.4ms 🟢 2.2ms -7.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/unsupported-type 🟢 0.4ms 🟢 0.4ms -2.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/version-progression 🟢 0.0ms 🟢 0.0ms -1.0%
 ↳ linter/@azure-tools/typespec-client-generator-core/property-name-conflict 🟢 1.1ms 🟢 1.0ms -5.4%
 ↳ linter/@azure-tools/typespec-client-generator-core/require-client-suffix 🟢 0.2ms 🟢 0.2ms -13.9%
emit 🟡 265.9ms 🟡 252.4ms -5.1% 🟢
 ↳ emit/@azure-tools/typespec-autorest 🟢 166.2ms 🟢 157.9ms -5.0%
 ↳ emit/@typespec/openapi3 🟢 147.8ms 🟢 141.7ms -4.1%
 ↳ emit/@typespec/openapi3/compute 🟢 133.7ms 🟢 126.9ms -5.1% 🟢
 ↳ emit/@typespec/openapi3/write 🟢 13.8ms 🟢 14.9ms +7.7% 🔴

Averaged across 3 specs (azure-arm-resource-manager, azure-core-dataplane, azure-full).
Threshold: changes > ±5% are highlighted.
🟢 Fast · 🟡 Moderate (stages >200ms, rules >10ms) · 🔴 Slow (stages >400ms, rules >20ms)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the @azure-tools/typespec-python emitter to the Azure TypeSpec playground bundle and introduces an upload step to publish the pygen wheel asset (from the inlined @typespec/http-client-python dependency) to blob storage so the browser runtime can fetch it.

Changes:

  • Register @azure-tools/typespec-python as a playground library so it can be loaded in the website.
  • Include @azure-tools/typespec-python in the bundler upload list.
  • Add a script to upload pygen-*.whl from the installed @typespec/http-client-python package to blob storage after bundling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/typespec-azure-playground-website/src/index.ts Adds @azure-tools/typespec-python to the playground library list.
eng/scripts/upload-python-emitter-assets.js New helper to upload the pygen wheel asset from the installed @typespec/http-client-python package.
eng/scripts/upload-bundler-packages.js Bundles @azure-tools/typespec-python and triggers the Python asset upload step.

Comment thread eng/scripts/upload-python-emitter-assets.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants