You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Automate bumping typespec-python version in emitter-package.json for the Azure SDK for Python repository. Use this skill when the user wants to update @azure-tools/typespec-python to the latest version, create a PR for the version bump, or manage emitter-package.json updates.
3
+
description: Automate updating the emitter package dependencies in eng/emitter-package.json for the Azure SDK for Python repository, then open a PR. Use this skill when the user wants to update @azure-tools/typespec-python (or any other dependency in emitter-package.json) to the latest version, create a PR for an emitter-package version bump, or manage emitter-package.json updates.
4
4
---
5
5
6
6
# Emitter Package Update
7
7
8
-
Bump `@azure-tools/typespec-python` to the latest version in `emitter-package.json` and create a PR.
8
+
Update the dependencies in `eng/emitter-package.json` to their latest versions — including
9
+
`@azure-tools/typespec-python` when a newer release exists — and, if anything changed, open a PR.
9
10
10
11
## Background
11
12
12
13
The Python emitter ecosystem consists of two packages:
13
14
-**Branded emitter** (`@azure-tools/typespec-python`): Lives in [Azure/typespec-azure](https://github.com/Azure/typespec-azure/tree/main/packages/typespec-python). This is the emitter used for Azure SDK generation.
14
15
-**Unbranded emitter** (`@typespec/http-client-python`): Lives in [microsoft/typespec](https://github.com/microsoft/typespec/tree/main/packages/http-client-python). The branded emitter wraps this package.
15
16
16
-
When `eng/emitter-package.json` is updated on `main`, the [TypeSpec Python Regenerate Tests](../../workflows/typespec-python-regenerate.yml) workflow triggers automatically and pushes regenerated test codeto the [`typespec-python-generated-tests`](https://github.com/Azure/azure-sdk-for-python/tree/typespec-python-generated-tests/eng/tools/azure-sdk-tools/emitter/generated) branch.
17
+
When `eng/emitter-package.json` is updated on `main`, the [TypeSpec Python Regenerate Tests](../../workflows/typespec-python-regenerate.yml) workflow triggers automatically. It regenerates the test code, pushes it to a `regen/typespec-python-main` source branch, and (because GitHub Actions cannot open PRs in this repo) creates/updates a tracking issue with a pre-filled compare link that a maintainer clicks to open the PR against the [`typespec-python-generated-tests`](https://github.com/Azure/azure-sdk-for-python/tree/typespec-python-generated-tests/eng/tools/azure-sdk-tools/emitter/generated) target branch.
17
18
18
19
## Prerequisites
19
20
@@ -39,75 +40,128 @@ If any tool is missing:
39
40
40
41
### 1. Prepare Repository
41
42
42
-
Reset and sync the SDK repo to a clean state:
43
+
Reset and sync the SDK repo to a clean state.
44
+
> **Warning:** this discards all uncommitted changes and switches to `main`. Only run it on
45
+
> a clone/worktree dedicated to this task, never on a branch with work you want to keep.
43
46
44
47
```bash
45
48
git reset HEAD && git checkout .&& git clean -fd && git checkout origin/main && git pull origin main
46
49
```
47
50
48
-
### 2. Determine Latest Version
51
+
Record the current `@azure-tools/typespec-python` version from `eng/emitter-package.json`
52
+
(checking both the `dependencies` and `devDependencies` sections) so you can tell later
53
+
whether it was bumped.
49
54
50
-
Run npm-check-updates to find the latest `@azure-tools/typespec-python` version:
55
+
### 2. Update Dependencies (still on `main`)
56
+
57
+
The goal is to update **every** package across **both** the `dependencies` and
58
+
`devDependencies` sections of `eng/emitter-package.json` to its latest version — not just
59
+
`@azure-tools/typespec-python`. Run `npm-check-updates`, which upgrades all entries in both
Extract the target version from the output (e.g., `0.61.3`).
66
+
> **Restricted-network fallback (e.g. the coding-agent sandbox):**`npm-check-updates`
67
+
> needs access to the npm registry, which may be firewalled. If it cannot reach the registry,
68
+
> determine the latest `@azure-tools/typespec-python` version from GitHub instead — the
69
+
> newest published tag in [Azure/typespec-azure](https://github.com/Azure/typespec-azure/tags)
70
+
> (cross-checked against `packages/typespec-python/package.json` on `main`) — and edit
71
+
> `eng/emitter-package.json` by hand to that version.
72
+
73
+
Align `@azure-tools/openai-typespec` and `@typespec/openapi3` with the versions pinned in [azure-rest-api-specs/package.json](https://github.com/Azure/azure-rest-api-specs/blob/main/package.json) to ensure consistency between the emitter and the spec repo. Read the spec repo's current values for those two packages and set them to match in `eng/emitter-package.json` (do not assume specific version numbers — use whatever the spec repo currently pins).
74
+
75
+
If a specific version was requested, pin `@azure-tools/typespec-python` to that exact
76
+
version in `eng/emitter-package.json` (overriding what npm-check-updates picked).
57
77
58
-
### 3. Create Feature Branch
78
+
### 3. Check for Changes
79
+
80
+
Determine whether anything actually changed:
59
81
60
82
```bash
61
-
git checkout -b bump-typespec-python-{version}
83
+
git diff --quiet -- eng/emitter-package.json
62
84
```
63
85
64
-
Replace `{version}` with the actual version number (e.g., `bump-typespec-python-0.61.3`).
65
-
66
-
### 4. Update Dependencies
86
+
**Decision rule:** A PR must be created whenever there is *any* change to `eng/emitter-package.json` — this includes the case where `@azure-tools/typespec-python` itself is unchanged but one or more other dependencies (e.g. `@typespec/*`, `@azure-tools/openai-typespec`) were updated or aligned. Do **not** require a `typespec-python` version bump as a precondition for opening a PR.
67
87
68
-
Apply the version update:
88
+
- If there **is** a diff (exit code `1`), proceed to step 4 and open a PR.
89
+
- Only if there is **no** diff at all (exit code `0`) — meaning every dependency is already up to date — discard the working-tree changes and stop, as there is nothing to commit:
Align `@azure-tools/openai-typespec` and `@typespec/openapi3` with the versions pinned in [azure-rest-api-specs/package.json](https://github.com/Azure/azure-rest-api-specs/blob/main/package.json) to ensure consistency between the emitter and the spec repo. Check the spec repo's versions and update `eng/emitter-package.json` accordingly (e.g., set `"@azure-tools/openai-typespec": "1.8.0"` and `"@typespec/openapi3": "1.9.0"` to match).
95
+
### 4. Create Feature Branch
96
+
97
+
Read the (possibly updated) `@azure-tools/typespec-python` version and compare it with the
98
+
value recorded in step 1 to choose names:
75
99
76
-
### 5. Regenerate Config Files
100
+
-**If typespec-python was bumped** to `{version}`:
- PR body: `Update emitter-package.json dependencies to their latest aligned versions.`
77
108
78
-
If you have a local clone of `typespec-azure`, regenerate the lock file using the branded emitter's `package.json` to ensure `devDependencies` are aligned:
109
+
Create the branch, carrying over the working-tree changes:
Once the PR merges to `main`, the [TypeSpec Python Regenerate Tests](../../workflows/typespec-python-regenerate.yml) workflow triggers automatically because `eng/emitter-package.json` was modified. It will:
110
-
1. Install the branded emitter at the version specified in `eng/emitter-package.json`
111
-
2. Regenerate all test code
112
-
3. Push the updated generated files to the [`typespec-python-generated-tests`](https://github.com/Azure/azure-sdk-for-python/tree/typespec-python-generated-tests/eng/tools/azure-sdk-tools/emitter/generated) branch
113
-
4. If the workflow fails, a GitHub issue is created and assigned to @iscai-msft and @msyyc
163
+
1. Build `http-client-python` from `microsoft/typespec@main` and regenerate all test code
164
+
2. Commit the regenerated files to the `regen/typespec-python-main` source branch and force-push it
165
+
3. Create or update a tracking issue containing a pre-filled "compare" link (GitHub Actions cannot open PRs in this repo) so a maintainer can open the PR against the [`typespec-python-generated-tests`](https://github.com/Azure/azure-sdk-for-python/tree/typespec-python-generated-tests/eng/tools/azure-sdk-tools/emitter/generated) target branch. Merging that PR does **not** auto-close the tracking issue — close it manually.
166
+
- The tracking issue is assigned to whoever triggered a manual (`workflow_dispatch`) run, or to @iscai-msft and @msyyc for automatic `push`/`schedule` runs.
167
+
4. If the workflow fails, a separate failure-notification issue is created (or commented on) and assigned to @iscai-msft and @msyyc
0 commit comments