From 31ec2f39e92b6b343c7fb738bcc28c92bb5c8832 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 22 Oct 2026 03:23:32 +0000 Subject: [PATCH 1/4] chore(python): bump version to 0.39.1 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- packages/http-client-python/CHANGELOG.md | 6 +++ packages/http-client-python/package-lock.json | 42 +++++++++---------- packages/http-client-python/package.json | 6 +-- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/packages/http-client-python/CHANGELOG.md b/packages/http-client-python/CHANGELOG.md index 0e31d6dd18b..6ef06a27868 100644 --- a/packages/http-client-python/CHANGELOG.md +++ b/packages/http-client-python/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log - @typespec/http-client-python +## 0.39.1 + +### Bump dependencies + +- Bump dependencies of `@typespec/*` and `@azure-tools/*` to latest versions + ## 0.39.0 ### Features diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index 52142076ede..77312bf4945 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@typespec/http-client-python", - "version": "0.39.0", + "version": "0.39.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@typespec/http-client-python", - "version": "0.39.0", + "version": "0.39.1", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -18,7 +18,7 @@ }, "devDependencies": { "@azure-tools/azure-http-specs": "0.1.0-alpha.46", - "@azure-tools/typespec-autorest": "~0.73.0", + "@azure-tools/typespec-autorest": "~0.73.1", "@azure-tools/typespec-azure-core": "~0.73.0", "@azure-tools/typespec-azure-resource-manager": "~0.73.0", "@azure-tools/typespec-azure-rulesets": "~0.73.0", @@ -50,7 +50,7 @@ "node": ">=22.0.0" }, "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.73.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.73.1 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.73.0 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.73.0 <1.0.0", "@azure-tools/typespec-azure-rulesets": ">=0.73.0 <1.0.0", @@ -89,13 +89,13 @@ } }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.73.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/@azure-tools/typespec-autorest/-/typespec-autorest-0.73.0.tgz", - "integrity": "sha512-SvctS7ALld55xASlCNZ23KJJ2pfpSGIcnEhUzykS2p7QEMe9I2zCSNReQg/TklSVHsl303iO7LI6RoUqtQ/oOw==", + "version": "0.73.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.73.1.tgz", + "integrity": "sha512-CsHcF0tZC2JcNYJ6RqaSxISLDx4V4UtNufgPi1MGG0GePPNm4WcWMaQWyDlfvCgkVYXfFIdTgphRR3ZO6JzIfg==", "dev": true, "license": "MIT", "dependencies": { - "@azure-tools/typespec-azure-examples": "^0.2.0", + "@azure-tools/typespec-azure-examples": "^0.2.1", "yaml": "^2.9.0" }, "engines": { @@ -134,9 +134,9 @@ } }, "node_modules/@azure-tools/typespec-azure-examples": { - "version": "0.2.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/@azure-tools/typespec-azure-examples/-/typespec-azure-examples-0.2.0.tgz", - "integrity": "sha512-omv0wP/9+v3PEGy1lP/TD49hblBRc2PsCyaFekquwrIjCFP0ZNYyFD1tnxIWZkJBn2b+7zoc86I2t/aYj8LFpA==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-examples/-/typespec-azure-examples-0.2.1.tgz", + "integrity": "sha512-AAwLMg0/5KH8tj05sVKEAhqVBHZ0ccRTZ+zTMzCEgphRkrIx+yCjil+0U4WsKWws+H6bAcTELft9SOtNKSyatA==", "dev": true, "license": "MIT", "dependencies": { @@ -156,8 +156,8 @@ }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/cliui": { "version": "9.0.1", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/cliui/-/cliui-9.0.1.tgz", - "integrity": "sha1-b3iQ84b28feZU63B943sRvzC0pE=", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", "dev": true, "license": "ISC", "dependencies": { @@ -171,8 +171,8 @@ }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/cliui/node_modules/string-width": { "version": "7.2.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha1-tbuOIWXOJ11NQ0dt0nAK2Qkdttw=", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", "dev": true, "license": "MIT", "dependencies": { @@ -189,14 +189,14 @@ }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/emoji-regex": { "version": "10.6.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha1-vz1uj3+P0ipl2XA0dbwBRzV6aw0=", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", "dev": true, "license": "MIT" }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/string-width": { "version": "8.3.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/string-width/-/string-width-8.3.0.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.3.0.tgz", "integrity": "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==", "dev": true, "license": "MIT", @@ -213,7 +213,7 @@ }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/yargs": { "version": "18.2.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/yargs/-/yargs-18.2.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.2.0.tgz", "integrity": "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==", "dev": true, "license": "MIT", @@ -231,8 +231,8 @@ }, "node_modules/@azure-tools/typespec-azure-examples/node_modules/yargs-parser": { "version": "22.0.0", - "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/yargs-parser/-/yargs-parser-22.0.0.tgz", - "integrity": "sha1-h7gglAUbBWdxc0bs0A/RSASzV8g=", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "dev": true, "license": "ISC", "engines": { diff --git a/packages/http-client-python/package.json b/packages/http-client-python/package.json index 658262ab694..b118a2423e2 100644 --- a/packages/http-client-python/package.json +++ b/packages/http-client-python/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/http-client-python", - "version": "0.39.0", + "version": "0.39.1", "author": "Microsoft Corporation", "description": "TypeSpec emitter for Python SDKs", "homepage": "https://typespec.io", @@ -66,7 +66,7 @@ "emitter" ], "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.73.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.73.1 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.73.0 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.73.0 <1.0.0", "@azure-tools/typespec-azure-rulesets": ">=0.73.0 <1.0.0", @@ -104,7 +104,7 @@ "tsx": "^4.23.13" }, "devDependencies": { - "@azure-tools/typespec-autorest": "~0.73.0", + "@azure-tools/typespec-autorest": "~0.73.1", "@azure-tools/typespec-azure-core": "~0.73.0", "@azure-tools/typespec-azure-resource-manager": "~0.73.0", "@azure-tools/typespec-azure-rulesets": "~0.73.0", From 624f67671141a24506e474a16d4f0b75ccba5b40 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 22 Oct 2026 03:28:30 +0000 Subject: [PATCH 2/4] docs(python): make release workflow resumable end to end Adapt the Azure Python release workflow with safe resumption, observed validation fallbacks, internal release metadata, and authenticated publishing alternatives. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../python-release-0-39-1-2026-10-22.md | 7 + .../SKILL.md | 152 ++++++++++++------ 2 files changed, 109 insertions(+), 50 deletions(-) create mode 100644 .chronus/changes/python-release-0-39-1-2026-10-22.md diff --git a/.chronus/changes/python-release-0-39-1-2026-10-22.md b/.chronus/changes/python-release-0-39-1-2026-10-22.md new file mode 100644 index 00000000000..1ab15f8cc6b --- /dev/null +++ b/.chronus/changes/python-release-0-39-1-2026-10-22.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Release @typespec/http-client-python 0.39.1 with updated dependencies. diff --git a/.github/skills/http-client-python-bump-and-release/SKILL.md b/.github/skills/http-client-python-bump-and-release/SKILL.md index 1026d0c6bb5..328a1e03a66 100644 --- a/.github/skills/http-client-python-bump-and-release/SKILL.md +++ b/.github/skills/http-client-python-bump-and-release/SKILL.md @@ -1,78 +1,75 @@ --- name: http-client-python-bump-and-release -description: Create a PR to bump TypeSpec/Azure Tools dependencies, update peer dependencies, or release a new version of the http-client-python package. +description: "Release @typespec/http-client-python with updated TypeSpec/Azure Tools dependencies. Use when: bumping Python emitter dependencies, preparing a release, resuming a release branch, or creating its release PR." --- # HTTP Client Python Bump and Release -Create a PR to bump dependencies and release a new version of the http-client-python package. +Prepare, validate, and publish a release PR for `@typespec/http-client-python`. > **Note:** `{REPO}` refers to the root folder of the `microsoft/typespec` repository. -## Prerequisites +## Requirements -Before starting, verify that `npm-check-updates` is available: - -```bash -npx npm-check-updates --version -``` - -If the command fails or prompts for installation, install it globally: - -```bash -npm install -g npm-check-updates -``` +- Release only `@typespec/http-client-python`. This package is excluded from the pnpm workspace; use its npm scripts for installation, building, tests, formatting, and linting. +- Preserve existing task changes and commits. Reuse a supplied task branch or an existing release branch when resuming; do not bump an already prepared release again. +- Never reset, clean, delete, or overwrite unrelated changes or existing branches. +- Use an available authenticated integration for publishing and PR creation. An unauthenticated GitHub CLI is not proof that other integrations are unavailable. +- Do not publish an npm package or merge the PR. Completion means a verified release PR exists unless the user explicitly requests local preparation only. ## Workflow -1. Navigate to the package directory: +### 1. Prepare or Resume the Task Branch + +1. From `{REPO}`, inspect `git status --short`, the current branch, remotes, and existing task commits. Identify the remote for `microsoft/typespec` by URL, not by assuming its name is `origin`. +2. If a task or release branch already contains the intended release changes, retain it and continue from the first incomplete step. Record its actual name and the prepared version. Do not rerun versioning or dependency installation without a reason. +3. Otherwise, fetch `main` from the Microsoft remote and create an unused branch from that remote's `main`: ```bash - cd {REPO}/packages/http-client-python + git fetch main + git switch --create publish/python-release- /main ``` -2. Reset and sync with main: + Use the current date. If the name is occupied by unrelated work, choose an unused suffix; do not overwrite it. If existing uncommitted changes prevent switching safely, stop and ask rather than discarding them. - ```bash - git reset HEAD && git checkout . && git checkout origin/main && git pull origin main - ``` +4. Record the actual branch with `git branch --show-current`. Run the following package commands from `{REPO}/packages/http-client-python` unless otherwise stated. + +### 2. Update Dependencies -3. Create release branch (use current date in MM-DD format): +1. Verify `npm-check-updates` is available: ```bash - git checkout -b publish/python-release-{MM-DD} + npx --no-install npm-check-updates --version ``` -4. Update dependencies: + If missing, install it with `npm install -g npm-check-updates`. + +2. Record the original dependency versions, especially the peer ranges and the two spec packages. Update only the TypeSpec/Azure Tools dependencies: ```bash - npx npm-check-updates -u --filter @typespec/*,@azure-tools/* --packageFile package.json + npx --no-install npm-check-updates -u --filter '@typespec/*,@azure-tools/*' --packageFile package.json ``` -5. Update `peerDependencies` in package.json: - - If format is `">=0.a.b <1.0.0"`: Update only the `0.a.b` portion, keep the range format unchanged - - If format is `"^1.a.b"`: Update to the latest version - -6. Verify `devDependencies` versions for specs: - - Check `@typespec/http-specs` and `@azure-tools/azure-http-specs` - - If the original version in `package.json` is newer than the updated value, keep the original version - - Dev versions are typically in the form `x.y.z-alpha.N-dev.M` (e.g., `0.1.0-alpha.37-dev.3`). +3. Update `peerDependencies` to the corresponding latest versions while preserving the existing range format: + - For `">=0.a.b <1.0.0"`, update only the lower bound; keep `<1.0.0`. + - For `"^1.a.b"`, update the version and keep `^`. +4. Verify `@typespec/http-specs` and `@azure-tools/azure-http-specs` did not regress. Compare semantic versions rather than strings. Preserve an original development prerelease if it is newer than the proposed update: + - `0.1.0-alpha.12-dev.5` is newer than `0.1.0-alpha.11`: keep the original. + - `0.1.0-alpha.12` is newer than `0.1.0-alpha.12-dev.5`: accept the update. +5. If dependencies are already current, report that fact and continue with the release. - Example: - - Original: `@typespec/http-specs: 0.1.0-alpha.12-dev.5`, updated by step 4 to `0.1.0-alpha.11` → keep `0.1.0-alpha.12-dev.5`. - - Original: `@typespec/http-specs: 0.1.0-alpha.12-dev.5`, updated by step 4 to `0.1.0-alpha.12` → keep `0.1.0-alpha.12` (step 4 works as expected). - - Original: `@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2`, updated to `0.1.0-alpha.11` → keep `0.1.0-alpha.12-dev.2`. - - Original: `@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2`, updated to `0.1.0-alpha.12` → keep `0.1.0-alpha.12` (step 4 works as expected). +### 3. Version the Python Emitter -7. Run version change script: +1. Record the original package version, then run: ```bash npm run change:version ``` - Verify that the script updated both the emitter version in `package.json` and `CHANGELOG.md`. If neither file was updated: - - Increment the third component of the emitter version in `package.json` (for example, `a.b.c` to `a.b.(c+1)`). - - Add this entry near the top of `CHANGELOG.md`, immediately after the changelog title: +2. Check the command's exit status and inspect its effects on the package, changelog, and change files. A failure or a partial version bump is not success. Investigate partial changes before continuing. +3. If both `package.json` and `CHANGELOG.md` remain unchanged, including when pnpm fails during root dependency setup, use the manual fallback instead of repeatedly retrying the same failing setup: + - Increment only the patch component from `a.b.c` to `a.b.(c+1)`. + - Add this entry immediately below the changelog title: ```markdown ## @@ -82,22 +79,77 @@ npm install -g npm-check-updates - Bump dependencies of `@typespec/*` and `@azure-tools/*` to latest versions ``` - - Verify that the version in `package.json` matches the new `CHANGELOG.md` heading. +4. Verify the package version matches the newest changelog heading. If Chronus generated a release entry, keep it instead of adding a duplicate. + +### 4. Install and Validate + +1. Install dependencies and update the package-local lockfile: + + ```bash + npm install + ``` + + If the configured Azure npm mirror fails with a missing public package or tarball, report the error and retry public dependencies against npmjs without changing repository or global registry settings: + + ```bash + npm install --registry=https://registry.npmjs.org --replace-registry-host=always + ``` + + Do not bypass supply-chain checks or expose credentials. For authentication failures affecting non-public packages, use an available authorized integration or report the blocker. Keep lockfile changes scoped to this release and its transitive dependency updates. + +2. Build and run emitter tests: -8. Build and commit: + ```bash + npm run build + npm run test:emitter + ``` ```bash - npm install && npm run build && git add -u && git commit -m "bump version" + npm run format + npm run lint ``` -9. Push and create PR: +3. If formatting fails only because unrelated root Prettier plugins are unavailable, report that limitation and validate the changed JSON files with the repository's scalar formatting settings. For the current configuration: ```bash - cd {REPO} - git push origin HEAD + npm exec -- prettier --no-config --print-width 100 --end-of-line lf --write package.json package-lock.json + npm exec -- prettier --no-config --print-width 100 --end-of-line lf --check package.json package-lock.json ``` -10. Create PR with title `[python] release new version` and no description. + Run lint separately even if formatting failed. Do not claim the full formatter passed. For modified skill Markdown, validate its frontmatter and format it using the same scalar settings; do not skip applicable plugins for source-code changes. + +4. Compile a small TypeSpec service with `@typespec/http-client-python`, verify it generated Python files, and check their syntax. Use a task-owned temporary location and remove only those smoke-test files afterward. +5. Verify the package and lockfile versions agree, the lockfile matches the manifest, and installed peer dependencies satisfy all declared ranges. +6. From `{REPO}`, add an `internal` change description for only the Python emitter after versioning: + + ```bash + pnpm chronus add @typespec/http-client-python --kind internal --message "Release @typespec/http-client-python with updated dependencies." + ``` + + Verify an actual valid file was created; a zero exit status or `No package changed. Exiting.` is not sufficient. If Chronus is unavailable or creates no file, report the outcome and manually create a uniquely named `.md` file under `.chronus/changes/`: + + ```markdown + --- + changeKind: internal + packages: + - "@typespec/http-client-python" + --- + + Release @typespec/http-client-python with updated dependencies. + ``` + + Do not rerun versioning after adding this file; it must remain in the release PR. + +7. Inspect `git diff --check`, `git diff --stat`, and `git status --short`. Expected changes are the Python package's `package.json`, `package-lock.json`, `CHANGELOG.md`, change files consumed by Chronus, and the new `internal` change file. Include skill changes only when the user requested them in this PR. Investigate unexpected changes before committing. + +### 5. Commit, Publish, and Verify the Pull Request + +1. Stage only the validated release files, including the new internal change file and any explicitly requested skill update. Commit with a conventional message such as `chore(python): release ` and any required co-author trailer. When resuming, preserve existing release commits and add a new commit for additional changes; do not amend unless requested. +2. Publish the actual task branch using an available authenticated mechanism, such as Git, a VS Code GitHub integration, or the environment's publishing workflow. Follow repository rules for personal forks; do not assume the push remote is `origin`. +3. Prefer authenticated `gh` when available. Otherwise discover and try an authenticated GitHub/VS Code publishing or PR integration before asking the user to log in. If the PR tool can publish an unpublished branch, let it do so and verify the published result. +4. Create a non-draft PR against `microsoft/typespec`, targeting `main`, with the exact title `[python] release new version` and an empty body. Reuse an existing matching open release PR rather than creating a duplicate. +5. Verify the returned PR's repository, base and actual head branch, head commit, exact title, empty body, release file list, and inclusion of the internal change file and any requested skill update. A local commit or a branch push alone is not completion. +6. If a publishing attempt fails, inspect the actual error, correct the documented workflow when warranted, and retry through an available authorized integration. Do not retry unchanged failures indefinitely, fabricate a PR URL, or report an unpublished branch as a completed release. If no authenticated publishing mechanism works, report the specific blocker and request the minimum user action needed. ## Post-Process Review @@ -108,6 +160,6 @@ npm install -g npm-check-updates - A step was ambiguous enough to create a real risk or delay. - A command was unnecessary or could be replaced by a demonstrably safer or more reliable command. 3. Do not change the skill based on preference, speculation, or an unobserved edge case. For every update, record the observed evidence and explain why the edit improves future releases. -4. Keep any skill update minimal, validate its formatting and frontmatter, and keep it separate from the completed release PR unless the user explicitly asks to include it there. +4. Keep any skill update focused and validate its formatting and frontmatter. Keep it separate from the release PR unless the user explicitly asks to include it there; in that case commit it on the release branch, publish it, and verify the PR contains it. 5. If the review finds no evidence-backed improvement, leave the skill unchanged and state that no update was warranted. -6. Return the branch name, released package version, `@typespec/http-client-python` version, commit hash, pull request URL, review findings, and any skill update to the user. +6. Return the actual branch, prepared `@typespec/http-client-python` version, commit hash, verified PR URL, validation results and limitations, review findings, and any skill update. Distinguish a prepared release PR from an npm publication. From 8a0f3b91345cbf10a36c44a629e4add890bf70c5 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 22 Oct 2026 03:29:38 +0000 Subject: [PATCH 3/4] docs(python): document publishing authentication recovery Record the observed VS Code callback error and independent Git authentication failure, with resumable CLI publishing instructions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../http-client-python-bump-and-release/SKILL.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/skills/http-client-python-bump-and-release/SKILL.md b/.github/skills/http-client-python-bump-and-release/SKILL.md index 328a1e03a66..dade56b6fd0 100644 --- a/.github/skills/http-client-python-bump-and-release/SKILL.md +++ b/.github/skills/http-client-python-bump-and-release/SKILL.md @@ -147,7 +147,17 @@ Prepare, validate, and publish a release PR for `@typespec/http-client-python`. 1. Stage only the validated release files, including the new internal change file and any explicitly requested skill update. Commit with a conventional message such as `chore(python): release ` and any required co-author trailer. When resuming, preserve existing release commits and add a new commit for additional changes; do not amend unless requested. 2. Publish the actual task branch using an available authenticated mechanism, such as Git, a VS Code GitHub integration, or the environment's publishing workflow. Follow repository rules for personal forks; do not assume the push remote is `origin`. 3. Prefer authenticated `gh` when available. Otherwise discover and try an authenticated GitHub/VS Code publishing or PR integration before asking the user to log in. If the PR tool can publish an unpublished branch, let it do so and verify the published result. + - A VS Code PR tool error such as `Callback URL is required` means that integration is unavailable, not that the PR title or body needs changing. Fall back to Git and `gh`; do not repeat the same tool call unchanged. + - Check Git publishing independently of `gh` authentication with `git push --dry-run HEAD`. Public fetch access and read-only GitHub tools do not establish push permission. + - If neither Git nor a publishing integration can authenticate, ask the user to run `gh auth login` and, when needed, `gh auth setup-git`, or repair the integration. Do not ask them to paste a token into chat. Resume from publishing after authentication; do not repeat versioning or validation of unchanged files. 4. Create a non-draft PR against `microsoft/typespec`, targeting `main`, with the exact title `[python] release new version` and an empty body. Reuse an existing matching open release PR rather than creating a duplicate. + With authenticated Git and CLI access, use: + + ```bash + git push --set-upstream HEAD + gh pr create --repo microsoft/typespec --base main --head : --title "[python] release new version" --body "" + ``` + 5. Verify the returned PR's repository, base and actual head branch, head commit, exact title, empty body, release file list, and inclusion of the internal change file and any requested skill update. A local commit or a branch push alone is not completion. 6. If a publishing attempt fails, inspect the actual error, correct the documented workflow when warranted, and retry through an available authorized integration. Do not retry unchanged failures indefinitely, fabricate a PR URL, or report an unpublished branch as a completed release. If no authenticated publishing mechanism works, report the specific blocker and request the minimum user action needed. From 29a4686cc53d07ba2014443dbd0eb4846bbc5ea8 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 22 Oct 2026 03:31:51 +0000 Subject: [PATCH 4/4] docs(python): scope release skill changes to publishing Preserve the original dependency and release flow, selectively adapt publishing and PR verification guidance, and remove the copied Azure internal change-file requirement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../python-release-0-39-1-2026-10-22.md | 7 - .../SKILL.md | 168 +++++++----------- 2 files changed, 64 insertions(+), 111 deletions(-) delete mode 100644 .chronus/changes/python-release-0-39-1-2026-10-22.md diff --git a/.chronus/changes/python-release-0-39-1-2026-10-22.md b/.chronus/changes/python-release-0-39-1-2026-10-22.md deleted file mode 100644 index 1ab15f8cc6b..00000000000 --- a/.chronus/changes/python-release-0-39-1-2026-10-22.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - "@typespec/http-client-python" ---- - -Release @typespec/http-client-python 0.39.1 with updated dependencies. diff --git a/.github/skills/http-client-python-bump-and-release/SKILL.md b/.github/skills/http-client-python-bump-and-release/SKILL.md index dade56b6fd0..32d14d7721d 100644 --- a/.github/skills/http-client-python-bump-and-release/SKILL.md +++ b/.github/skills/http-client-python-bump-and-release/SKILL.md @@ -1,75 +1,84 @@ --- name: http-client-python-bump-and-release -description: "Release @typespec/http-client-python with updated TypeSpec/Azure Tools dependencies. Use when: bumping Python emitter dependencies, preparing a release, resuming a release branch, or creating its release PR." +description: Create a PR to bump TypeSpec/Azure Tools dependencies, update peer dependencies, or release a new version of the http-client-python package. --- # HTTP Client Python Bump and Release -Prepare, validate, and publish a release PR for `@typespec/http-client-python`. +Create a PR to bump dependencies and release a new version of the http-client-python package. > **Note:** `{REPO}` refers to the root folder of the `microsoft/typespec` repository. -## Requirements +## Prerequisites -- Release only `@typespec/http-client-python`. This package is excluded from the pnpm workspace; use its npm scripts for installation, building, tests, formatting, and linting. -- Preserve existing task changes and commits. Reuse a supplied task branch or an existing release branch when resuming; do not bump an already prepared release again. -- Never reset, clean, delete, or overwrite unrelated changes or existing branches. -- Use an available authenticated integration for publishing and PR creation. An unauthenticated GitHub CLI is not proof that other integrations are unavailable. -- Do not publish an npm package or merge the PR. Completion means a verified release PR exists unless the user explicitly requests local preparation only. +Before starting, verify that `npm-check-updates` is available: + +```bash +npx npm-check-updates --version +``` + +If the command fails or prompts for installation, install it globally: + +```bash +npm install -g npm-check-updates +``` ## Workflow -### 1. Prepare or Resume the Task Branch +Before starting or resuming, inspect the working tree, current branch, remotes, and existing release commits. Preserve existing task work. If the branch already contains the prepared release, continue from the first incomplete step instead of repeating dependency updates or incrementing the version again. -1. From `{REPO}`, inspect `git status --short`, the current branch, remotes, and existing task commits. Identify the remote for `microsoft/typespec` by URL, not by assuming its name is `origin`. -2. If a task or release branch already contains the intended release changes, retain it and continue from the first incomplete step. Record its actual name and the prepared version. Do not rerun versioning or dependency installation without a reason. -3. Otherwise, fetch `main` from the Microsoft remote and create an unused branch from that remote's `main`: +1. Navigate to the package directory: ```bash - git fetch main - git switch --create publish/python-release- /main + cd {REPO}/packages/http-client-python ``` - Use the current date. If the name is occupied by unrelated work, choose an unused suffix; do not overwrite it. If existing uncommitted changes prevent switching safely, stop and ask rather than discarding them. +2. For a new release, fetch `main` from the remote whose URL points to `microsoft/typespec`: -4. Record the actual branch with `git branch --show-current`. Run the following package commands from `{REPO}/packages/http-client-python` unless otherwise stated. + ```bash + git fetch main + ``` -### 2. Update Dependencies + Do not reset or discard existing changes to prepare a release. -1. Verify `npm-check-updates` is available: +3. Create release branch (use current date in MM-DD format), unless the environment already supplied the task branch: ```bash - npx --no-install npm-check-updates --version + git switch --create publish/python-release-{MM-DD} /main ``` - If missing, install it with `npm install -g npm-check-updates`. + If the name belongs to unrelated work, choose an unused suffix; never overwrite it. Record the actual task branch with `git branch --show-current` for publishing and PR verification. -2. Record the original dependency versions, especially the peer ranges and the two spec packages. Update only the TypeSpec/Azure Tools dependencies: +4. Update dependencies: ```bash - npx --no-install npm-check-updates -u --filter '@typespec/*,@azure-tools/*' --packageFile package.json + npx npm-check-updates -u --filter @typespec/*,@azure-tools/* --packageFile package.json ``` -3. Update `peerDependencies` to the corresponding latest versions while preserving the existing range format: - - For `">=0.a.b <1.0.0"`, update only the lower bound; keep `<1.0.0`. - - For `"^1.a.b"`, update the version and keep `^`. -4. Verify `@typespec/http-specs` and `@azure-tools/azure-http-specs` did not regress. Compare semantic versions rather than strings. Preserve an original development prerelease if it is newer than the proposed update: - - `0.1.0-alpha.12-dev.5` is newer than `0.1.0-alpha.11`: keep the original. - - `0.1.0-alpha.12` is newer than `0.1.0-alpha.12-dev.5`: accept the update. -5. If dependencies are already current, report that fact and continue with the release. +5. Update `peerDependencies` in package.json: + - If format is `">=0.a.b <1.0.0"`: Update only the `0.a.b` portion, keep the range format unchanged + - If format is `"^1.a.b"`: Update to the latest version -### 3. Version the Python Emitter +6. Verify `devDependencies` versions for specs: + - Check `@typespec/http-specs` and `@azure-tools/azure-http-specs` + - If the original version in `package.json` is newer than the updated value, keep the original version + - Dev versions are typically in the form `x.y.z-alpha.N-dev.M` (e.g., `0.1.0-alpha.37-dev.3`). -1. Record the original package version, then run: + Example: + - Original: `@typespec/http-specs: 0.1.0-alpha.12-dev.5`, updated by step 4 to `0.1.0-alpha.11` → keep `0.1.0-alpha.12-dev.5`. + - Original: `@typespec/http-specs: 0.1.0-alpha.12-dev.5`, updated by step 4 to `0.1.0-alpha.12` → keep `0.1.0-alpha.12` (step 4 works as expected). + - Original: `@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2`, updated to `0.1.0-alpha.11` → keep `0.1.0-alpha.12-dev.2`. + - Original: `@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2`, updated to `0.1.0-alpha.12` → keep `0.1.0-alpha.12` (step 4 works as expected). + +7. Run version change script: ```bash npm run change:version ``` -2. Check the command's exit status and inspect its effects on the package, changelog, and change files. A failure or a partial version bump is not success. Investigate partial changes before continuing. -3. If both `package.json` and `CHANGELOG.md` remain unchanged, including when pnpm fails during root dependency setup, use the manual fallback instead of repeatedly retrying the same failing setup: - - Increment only the patch component from `a.b.c` to `a.b.(c+1)`. - - Add this entry immediately below the changelog title: + Check the command's exit status and investigate partial changes on failure. Verify that the script updated both the emitter version in `package.json` and `CHANGELOG.md`. If neither file was updated: + - Increment the third component of the emitter version in `package.json` (for example, `a.b.c` to `a.b.(c+1)`). + - Add this entry near the top of `CHANGELOG.md`, immediately after the changelog title: ```markdown ## @@ -79,87 +88,38 @@ Prepare, validate, and publish a release PR for `@typespec/http-client-python`. - Bump dependencies of `@typespec/*` and `@azure-tools/*` to latest versions ``` -4. Verify the package version matches the newest changelog heading. If Chronus generated a release entry, keep it instead of adding a duplicate. - -### 4. Install and Validate - -1. Install dependencies and update the package-local lockfile: - - ```bash - npm install - ``` - - If the configured Azure npm mirror fails with a missing public package or tarball, report the error and retry public dependencies against npmjs without changing repository or global registry settings: - - ```bash - npm install --registry=https://registry.npmjs.org --replace-registry-host=always - ``` - - Do not bypass supply-chain checks or expose credentials. For authentication failures affecting non-public packages, use an available authorized integration or report the blocker. Keep lockfile changes scoped to this release and its transitive dependency updates. + - Verify that the version in `package.json` matches the new `CHANGELOG.md` heading. -2. Build and run emitter tests: +8. Build and commit: ```bash - npm run build - npm run test:emitter + npm install && npm run build ``` - ```bash - npm run format - npm run lint - ``` + Complete the repository's applicable validation before committing. Stage only the release files and any explicitly requested skill update; do not stage unrelated work. Use a conventional commit message and the required co-author trailer. Preserve existing release commits when resuming. -3. If formatting fails only because unrelated root Prettier plugins are unavailable, report that limitation and validate the changed JSON files with the repository's scalar formatting settings. For the current configuration: +9. Publish the actual task branch: + - Identify the push remote by URL, following the repository's personal-fork rules; do not assume it is `origin`. + - Prefer authenticated Git and `gh`. If GitHub CLI is unavailable or unauthenticated, discover and try an available authenticated GitHub/VS Code publishing integration before asking the user to log in. + - Git authentication is independent of `gh`: check it with `git push --dry-run HEAD`. Public fetch access and read-only API access do not establish push permission. + - Publish with Git, or let a publishing-capable PR integration publish the branch: ```bash - npm exec -- prettier --no-config --print-width 100 --end-of-line lf --write package.json package-lock.json - npm exec -- prettier --no-config --print-width 100 --end-of-line lf --check package.json package-lock.json - ``` - - Run lint separately even if formatting failed. Do not claim the full formatter passed. For modified skill Markdown, validate its frontmatter and format it using the same scalar settings; do not skip applicable plugins for source-code changes. - -4. Compile a small TypeSpec service with `@typespec/http-client-python`, verify it generated Python files, and check their syntax. Use a task-owned temporary location and remove only those smoke-test files afterward. -5. Verify the package and lockfile versions agree, the lockfile matches the manifest, and installed peer dependencies satisfy all declared ranges. -6. From `{REPO}`, add an `internal` change description for only the Python emitter after versioning: - - ```bash - pnpm chronus add @typespec/http-client-python --kind internal --message "Release @typespec/http-client-python with updated dependencies." - ``` - - Verify an actual valid file was created; a zero exit status or `No package changed. Exiting.` is not sufficient. If Chronus is unavailable or creates no file, report the outcome and manually create a uniquely named `.md` file under `.chronus/changes/`: - - ```markdown - --- - changeKind: internal - packages: - - "@typespec/http-client-python" - --- - - Release @typespec/http-client-python with updated dependencies. + git push --set-upstream HEAD ``` - Do not rerun versioning after adding this file; it must remain in the release PR. - -7. Inspect `git diff --check`, `git diff --stat`, and `git status --short`. Expected changes are the Python package's `package.json`, `package-lock.json`, `CHANGELOG.md`, change files consumed by Chronus, and the new `internal` change file. Include skill changes only when the user requested them in this PR. Investigate unexpected changes before committing. - -### 5. Commit, Publish, and Verify the Pull Request +10. Create and verify the PR: + - Target `microsoft/typespec`, base `main`, from the actual published branch, with the exact title `[python] release new version` and an empty body. Reuse an existing matching open PR rather than creating a duplicate. + - Use an available authenticated integration; GitHub CLI is optional. With authenticated CLI access: -1. Stage only the validated release files, including the new internal change file and any explicitly requested skill update. Commit with a conventional message such as `chore(python): release ` and any required co-author trailer. When resuming, preserve existing release commits and add a new commit for additional changes; do not amend unless requested. -2. Publish the actual task branch using an available authenticated mechanism, such as Git, a VS Code GitHub integration, or the environment's publishing workflow. Follow repository rules for personal forks; do not assume the push remote is `origin`. -3. Prefer authenticated `gh` when available. Otherwise discover and try an authenticated GitHub/VS Code publishing or PR integration before asking the user to log in. If the PR tool can publish an unpublished branch, let it do so and verify the published result. - - A VS Code PR tool error such as `Callback URL is required` means that integration is unavailable, not that the PR title or body needs changing. Fall back to Git and `gh`; do not repeat the same tool call unchanged. - - Check Git publishing independently of `gh` authentication with `git push --dry-run HEAD`. Public fetch access and read-only GitHub tools do not establish push permission. - - If neither Git nor a publishing integration can authenticate, ask the user to run `gh auth login` and, when needed, `gh auth setup-git`, or repair the integration. Do not ask them to paste a token into chat. Resume from publishing after authentication; do not repeat versioning or validation of unchanged files. -4. Create a non-draft PR against `microsoft/typespec`, targeting `main`, with the exact title `[python] release new version` and an empty body. Reuse an existing matching open release PR rather than creating a duplicate. - With authenticated Git and CLI access, use: - - ```bash - git push --set-upstream HEAD - gh pr create --repo microsoft/typespec --base main --head : --title "[python] release new version" --body "" - ``` + ```bash + gh pr create --repo microsoft/typespec --base main --head : --title "[python] release new version" --body "" + ``` -5. Verify the returned PR's repository, base and actual head branch, head commit, exact title, empty body, release file list, and inclusion of the internal change file and any requested skill update. A local commit or a branch push alone is not completion. -6. If a publishing attempt fails, inspect the actual error, correct the documented workflow when warranted, and retry through an available authorized integration. Do not retry unchanged failures indefinitely, fabricate a PR URL, or report an unpublished branch as a completed release. If no authenticated publishing mechanism works, report the specific blocker and request the minimum user action needed. + - Verify the created PR's repository, base and head branches, head commit, exact title, empty body, and release files. If the user requested skill changes in this PR, verify they are included too. + - Inspect publishing errors before retrying. For example, `Callback URL is required` indicates the VS Code integration is unavailable; fall back to another authorized publishing route, not another identical tool call. + - If Git and all available publishing integrations are blocked, report the errors and request authentication, such as `gh auth login` and `gh auth setup-git`, or integration repair. Never ask for a token in chat. Resume at publishing once access is restored. + - A local commit or branch push is not completion: return a verified PR URL, or explicitly report that PR creation is blocked. Do not publish to npm or merge the PR. ## Post-Process Review