diff --git a/eng/scripts/upload-bundler-packages.js b/eng/scripts/upload-bundler-packages.js index c3d22b35a2..9106b7fc75 100644 --- a/eng/scripts/upload-bundler-packages.js +++ b/eng/scripts/upload-bundler-packages.js @@ -4,6 +4,7 @@ import { getPackageVersion, } from "../../core/packages/bundle-uploader/dist/src/index.js"; import { repoRoot } from "./helpers.js"; +import { uploadPythonEmitterAssets } from "./upload-python-emitter-assets.js"; await bundleAndUploadPackages({ repoRoot: repoRoot, @@ -27,5 +28,8 @@ await bundleAndUploadPackages({ "@azure-tools/typespec-client-generator-core", "@azure-tools/typespec-azure-resource-manager", "@azure-tools/typespec-azure-rulesets", + "@azure-tools/typespec-python", ], }); + +await uploadPythonEmitterAssets(repoRoot); diff --git a/eng/scripts/upload-python-emitter-assets.js b/eng/scripts/upload-python-emitter-assets.js new file mode 100644 index 0000000000..6e93b37caf --- /dev/null +++ b/eng/scripts/upload-python-emitter-assets.js @@ -0,0 +1,28 @@ +// @ts-check +import { createRequire } from "module"; +import { dirname, resolve } from "path"; +import { uploadStandalonePackageAssets } from "../../core/packages/bundle-uploader/dist/src/index.js"; + +/** + * Upload the pygen wheel from the installed @typespec/http-client-python package. + * The wheel is fetched at runtime in the browser by the inlined http-client-python code. + * + * @param {string} repoRoot + */ +export async function uploadPythonEmitterAssets(repoRoot) { + const typespecPythonRequire = createRequire( + resolve(repoRoot, "packages/typespec-python/package.json"), + ); + const httpClientPythonEntry = typespecPythonRequire.resolve("@typespec/http-client-python"); + const httpClientPythonPath = resolve(dirname(httpClientPythonEntry), "../.."); + + await uploadStandalonePackageAssets({ + packagePath: httpClientPythonPath, + assets: [ + { + path: "generator/dist/pygen-*.whl", + contentType: "application/zip", + }, + ], + }); +} diff --git a/packages/typespec-azure-playground-website/src/index.ts b/packages/typespec-azure-playground-website/src/index.ts index 7c6ff7f5ac..e8eafc9aaf 100644 --- a/packages/typespec-azure-playground-website/src/index.ts +++ b/packages/typespec-azure-playground-website/src/index.ts @@ -20,6 +20,7 @@ export const TypeSpecPlaygroundConfig = { "@azure-tools/typespec-autorest", "@azure-tools/typespec-client-generator-core", "@azure-tools/typespec-azure-rulesets", + "@azure-tools/typespec-python", ], samples, } as const;