From 94a749a849a5758d76005ac4e5a8df578c8c6d1b Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 4 Feb 2026 16:47:20 +0800 Subject: [PATCH 1/3] docs: Add classic scenario for committing changes to autorest.python PR --- .../copying-typespec-test-changes/SKILL.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 .github/skills/copying-typespec-test-changes/SKILL.md diff --git a/.github/skills/copying-typespec-test-changes/SKILL.md b/.github/skills/copying-typespec-test-changes/SKILL.md new file mode 100644 index 0000000000..7d46b7d471 --- /dev/null +++ b/.github/skills/copying-typespec-test-changes/SKILL.md @@ -0,0 +1,127 @@ +--- +name: copying-typespec-test-changes +description: Copies test file changes from Microsoft/typespec repo PRs to Azure/autorest.python repo. Use when user provides a Microsoft/typespec PR link and asks to sync test changes from http-client-python/generator/test to packages/typespec-python/test folder. +--- + +# Copying TypeSpec Test Changes to autorest.python + +## Overview + +The `packages/typespec-python/test` folder in Azure/autorest.python mirrors the `packages/http-client-python/generator/test` folder in Microsoft/typespec. When test changes are made in typespec, they need to be copied to autorest.python. + +## Workflow + +Copy this checklist and track your progress: + +``` +Task Progress: +- [ ] Step 1: Extract changed files from typespec PR +- [ ] Step 2: Identify test file changes in http-client-python/generator/test +- [ ] Step 3: Copy changes to packages/typespec-python/test +- [ ] Step 4: Format files with black +- [ ] Step 5: Verify changes +``` + +### Step 1: Extract changed files from typespec PR + +Use the GitHub tool to fetch the PR details from Microsoft/typespec + +### Step 2: Identify test file changes + +Filter the changed files list to only include files under: +- `packages/http-client-python/generator/test/` + +Ignore changes outside this path. + +### Step 3: Copy changes to autorest.python + +For each changed test file: + +1. **Map the path**: Replace `packages/http-client-python/generator/test/` with `packages/typespec-python/test/` + + Example: + - Source: `packages/http-client-python/generator/test/azure/sample_test.py` + - Target: `packages/typespec-python/test/azure/sample_test.py` + +2. **Fetch the new content**: Get the file content from the typespec PR branch + +3. **Apply the change**: + - For new files: Create the file in autorest.python + - For modified files: Update the existing file to match + - For deleted files: Delete the corresponding file + +### Step 4: Format with black + +**MUST run after all file changes:** + +```bash +python -m black -l 120 +``` + +Run this command for each Python file that was created or modified. + +### Step 5: Verify changes + +1. Check that all target files exist and match source content +2. Confirm black formatting was applied (no formatting errors) +3. List all changes made for user review + +## Path mapping reference + +| TypeSpec repo path | autorest.python path | +|---|---| +| `packages/http-client-python/generator/test/` | `packages/typespec-python/test/` | + +## Important notes + +- **Consistency**: Copy content exactly to maintain consistency between repos +- **Formatting**: Always run `python -m black -l 120` on changed Python files +- **Scope**: Only copy files from the `generator/test` folder, ignore other changes +- **Verify**: After copying, the test files should be identical between repos (after formatting) + +## Example usage + +### Basic usage (local changes only) + +User prompt: "Copy test changes from https://github.com/microsoft/typespec/pull/1234 to this repo" + +1. Extract PR number: 1234 +2. Fetch PR #1234 from microsoft/typespec +3. Find files changed under `packages/http-client-python/generator/test/` +4. For each file, copy to corresponding path under `packages/typespec-python/test/` +5. Run black formatter on each changed Python file +6. Report summary of changes + +### Classic scenario (commit to autorest.python PR) + +In most cases, users will provide both: +- A **typespec PR link** (source of changes) +- An **autorest.python PR link** (destination to commit changes) + +User prompt: "Copy test changes from https://github.com/microsoft/typespec/pull/1234 to https://github.com/Azure/autorest.python/pull/5678" + +**Workflow:** + +1. Extract both PR numbers: typespec PR #1234, autorest.python PR #5678 +2. Fetch the autorest.python PR #5678 to get the target branch name +3. Checkout the target branch locally: + ```bash + git fetch origin + git checkout + ``` +4. Fetch typespec PR #1234 from microsoft/typespec +5. Find files changed under `packages/http-client-python/generator/test/` +6. For each file, copy to corresponding path under `packages/typespec-python/test/` +7. Run black formatter on each changed Python file +8. Stage, commit, and push changes to the PR branch: + ```bash + git add packages/typespec-python/test/ + git commit -m "Sync test changes from microsoft/typespec#1234" + git push origin + ``` +9. Report summary of changes committed to the PR + +**Important for PR commits:** +- Always fetch and checkout the PR branch before making changes +- Use a descriptive commit message referencing the source typespec PR +- Push to the same branch to update the existing autorest.python PR From 205d0123c75c4252371882bcc6a00a4b71c7e8d7 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 4 Feb 2026 09:01:32 +0000 Subject: [PATCH 2/3] docs: Add classic scenario for committing changes to autorest.python PR --- .github/skills/copying-typespec-test-changes/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/skills/copying-typespec-test-changes/SKILL.md b/.github/skills/copying-typespec-test-changes/SKILL.md index 7d46b7d471..2e8f3aef35 100644 --- a/.github/skills/copying-typespec-test-changes/SKILL.md +++ b/.github/skills/copying-typespec-test-changes/SKILL.md @@ -78,6 +78,7 @@ Run this command for each Python file that was created or modified. - **Formatting**: Always run `python -m black -l 120` on changed Python files - **Scope**: Only copy files from the `generator/test` folder, ignore other changes - **Verify**: After copying, the test files should be identical between repos (after formatting) +- **DO NOT address unrelated differences**: If you encounter existing discrepancies between the two repositories (such as in `requirements.txt` or other configuration files), refrain from trying to eliminate those differences. Focus solely on copying the modified code from the typespec pull request, disregarding any pre-existing variations. ## Example usage From b10753d7fc2fd74a218f0dbb09ad53d21ac6f6c2 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 4 Feb 2026 09:18:46 +0000 Subject: [PATCH 3/3] docs: Add requirements.txt update rule for editable installs only --- .github/skills/copying-typespec-test-changes/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/skills/copying-typespec-test-changes/SKILL.md b/.github/skills/copying-typespec-test-changes/SKILL.md index 2e8f3aef35..983eb3b3e2 100644 --- a/.github/skills/copying-typespec-test-changes/SKILL.md +++ b/.github/skills/copying-typespec-test-changes/SKILL.md @@ -78,7 +78,7 @@ Run this command for each Python file that was created or modified. - **Formatting**: Always run `python -m black -l 120` on changed Python files - **Scope**: Only copy files from the `generator/test` folder, ignore other changes - **Verify**: After copying, the test files should be identical between repos (after formatting) -- **DO NOT address unrelated differences**: If you encounter existing discrepancies between the two repositories (such as in `requirements.txt` or other configuration files), refrain from trying to eliminate those differences. Focus solely on copying the modified code from the typespec pull request, disregarding any pre-existing variations. +- **requirements.txt**: When updating `requirements.txt` files, only update dependencies with the `-e XXX` pattern (editable installs). Do NOT modify other dependencies in the file. ## Example usage