http-client-python 依赖升级与发布
http-client-python-bump-and-release
创建 PR 以升级 TypeSpec/Azure Tools 依赖、更新 peer 依赖,或发布 http-client-python 包的新版本。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 5.9k
- Forks
- 423
01 前言 Front Matter
- 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.
03 SKILL.md 正文
HTTP Client Python Bump and Release
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 themicrosoft/typespecrepository.
Prerequisites
Before starting, verify that npm-check-updates is available:
npx --no-install npm-check-updates --version
If the command fails or prompts for installation, install it globally:
npm install -g npm-check-updates
The version script also requires pnpm and the repository's workspace dependencies, even though the emitter uses npm. Verify that pnpm --version and pnpm exec chronus --version work from {REPO}. If pnpm is missing, install the version declared in the root package.json's packageManager field. If Chronus is missing, run pnpm install --frozen-lockfile from {REPO} before continuing.
Use the CFS feed https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/ for dependency queries and installation. From the package directory, verify that npm config get registry reports this feed; it is configured in the package's .npmrc. Do not silently fall back to npmjs.org if the feed is unavailable.
Workflow
-
Navigate to the package directory:
cd {REPO}/packages/http-client-python -
Inspect the worktree and fetch main without discarding local changes:
git status --short git fetch origin mainPreserve unrelated local work. Do not run
git resetorgit checkout .as release preparation. -
Create release branch (use current date in MM-DD format):
git switch -c publish/python-release-{MM-DD} origin/main -
Update dependencies:
npx npm-check-updates -u --filter '@typespec/*,@azure-tools/*' --packageFile package.json --registry https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/ -
Update
peerDependenciesin package.json:- Do not assume step 4 updated peer dependencies: in the release run it updated development dependencies but left peer lower bounds unchanged. Use the latest versions reported in step 4 for the corresponding peers.
- If format is
">=0.a.b <1.0.0": Update only the0.a.bportion, keep the range format unchanged - If format is
"^1.a.b": Update to the latest version
-
Verify
devDependenciesversions for specs:- Check
@typespec/http-specsand@azure-tools/azure-http-specs - If the original version in
package.jsonis 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).
Example:
- Original:
@typespec/http-specs: 0.1.0-alpha.12-dev.5, updated by step 4 to0.1.0-alpha.11→ keep0.1.0-alpha.12-dev.5. - Original:
@typespec/http-specs: 0.1.0-alpha.12-dev.5, updated by step 4 to0.1.0-alpha.12→ keep0.1.0-alpha.12(step 4 works as expected). - Original:
@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2, updated to0.1.0-alpha.11→ keep0.1.0-alpha.12-dev.2. - Original:
@azure-tools/azure-http-specs: 0.1.0-alpha.12-dev.2, updated to0.1.0-alpha.12→ keep0.1.0-alpha.12(step 4 works as expected).
- Check
-
Run version change script:
npm run change:versionVerify that the script updated both the emitter version in
package.jsonandCHANGELOG.md. If neither file was updated:-
Increment the third component of the emitter version in
package.json(for example,a.b.ctoa.b.(c+1)). -
Add this entry near the top of
CHANGELOG.md, immediately after the changelog title:## <new emitter version> ### Bump dependencies - Bump dependencies of `@typespec/*` and `@azure-tools/*` to latest versions
Verify that the version in
package.jsonmatches the newCHANGELOG.mdheading. Consumed Python change files under.chronus/changes/are expected deletions; include them in the release commit. -
-
Install, build, validate, and commit:
npm install --registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/ && npm run build npm run lint npm run test:emitterRun formatting from
{REPO}using thepnpm-formatskill. Ifpackages/prettier-plugin-typespec/dist/index.jsis missing, build the formatter first withpnpm -r --filter '@typespec/prettier-plugin-typespec...' build, then runpnpm format. Do not repeat dependency installation or build the entire monorepo for this missing-plugin error.Verify that
package-lock.jsonand its root package entry match the manifest version, peer dependencies, and development dependencies. Reviewgit diff --checkand the changed-file list; stage only the release manifest, lockfile, changelog, and consumed Python change files. Commit using a conventional message such aschore(python): bump version to <version>and the required co-author trailer.Check the lockfile diff for registry changes: preserve existing CFS URLs and resolve new or updated packages through CFS, without migrating unrelated pre-existing npmjs.org entries. Changing the registry and rerunning
npm install --package-lock-onlydid not repair existing npmjs.org URLs in the release run. If correcting such a lockfile, obtain the exact CFS tarball URLs from feed metadata and verify their contents against the lockfile integrity hashes before replacing URLs; do not blindly rewrite hosts or change package versions. -
Push and create PR:
cd {REPO} git push origin HEAD -
Create PR with title
[python] release new versionand no description.Verify the created PR's title, description, base/head branches, and draft state rather than relying on the creation tool's output. The release run's PR tool inserted a placeholder despite receiving an empty body; if this happens, clear it with
gh api --method PATCH repos/microsoft/typespec/pulls/<number> -f body=''and verify again. If the tool creates a draft, mark it ready withgh pr ready <number>unless the user requested a draft.
Post-Process Review
- After the pull request is created, review the complete release run: commands executed, command output, manual interventions, validation results, changed files, commit, push, cleanup, and PR creation.
- Update this skill only when the completed run provides a concrete finding and a strong reason for the change, such as:
- A documented step failed or produced an incorrect result.
- The agent needed an undocumented manual correction to complete the release.
- 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.
- 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.
- 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.
- If the review finds no evidence-backed improvement, leave the skill unchanged and state that no update was warranted.
- Return the branch name, prepared
@typespec/http-client-pythonversion, commit hash, pull request URL, review findings, and any skill update to the user. Creating a release PR does not mean the package has been published.
04 同仓库更多 Skills
http-client-python Emitter 构建与测试
test-unbranded-emitter
构建并测试 @typespec/http-client-python emitter。当用户想要测试其对 emitter 的本地变更、运行生成器测试套件、检查其 http-client-python 变更是否通过,或验证某项修复时使用。触发短语包括“test the emitter”(测试 emitter)、“run tests”(运行测试)、“check if my changes pass”(检查我的变更是否通过)、“run test:generator”(运行 test:generator)、“run CI”(运行 CI),或在 emitter 包中提及任何测试/验证变更的表述。
TypeSpec 生成 Python SDK 代码
generate-from-typespec
使用本地 emitter 从 TypeSpec 规范生成 Python SDK 代码。当用户想要从 TypeSpec 规范生成或重新生成 Python 客户端,提供了 TypeSpec 项目的 GitHub URL 或本地路径,或说出类似“generate from this spec”(从此规范生成)、“emit Python from this tsp”(从此 tsp 生成 Python)、“regenerate the SDK”(重新生成 SDK)、“compile this TypeSpec for Python”(将此 TypeSpec 编译为 Python)等表述时使用。
Emitter 生成代码与上游基线对比
diff-upstream
重新生成本地 emitter,并将生成的代码与已检入 autorest.python 的上游基线进行对比。当用户想查看其 emitter 变更对生成代码的影响(相较于当前生产环境的差异),或说出类似“diff upstream”(与上游对比)、“compare to baseline”(与基线比较)、“what changed vs production”(相较生产环境有哪些变化)、“show me the diff”(给我看差异)、“how does this affect generated code”(这如何影响生成代码)等表述,或希望验证其变更能产生预期的输出差异时使用。
Python SDK Spector 模拟 API 测试编写
writing-python-sdk-spector-mock-api-tests
根据 Spector 用例编写 TypeSpec http-client-python generator 的模拟 API 测试(azure/unbranded/shared)。当给定 Spector 用例链接,或修改 http-specs/azure-http-specs 下 Spector 用例的 PR 链接时使用。
pnpm 代码格式化
pnpm-format
使用 pnpm 格式化代码库,并从常见的格式化失败中恢复。
TypeSpec Bug 最小复现构建
minimal-repro
帮助创建 TypeSpec 编译器或 emitter bug 的最小复现。当用户提供 TypeSpec 源码(粘贴的代码或 GitHub URL)并描述问题时使用。在本地复现并缩减为单文件复现。