Skip to content

Commit 607cf6e

Browse files
authored
Merge branch 'main' into xitzhang/1.2.0change
2 parents 25c6fbd + 8a5dd35 commit 607cf6e

9,115 files changed

Lines changed: 1597586 additions & 323403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@
849849

850850
/scripts/ @scbedd @mccoyp
851851
/scripts/breaking_changes_checker/ @catalinaperalta
852-
/doc/ @scbedd @mccoyp
852+
/doc/ @scbedd @Azure/azure-python-sdk
853853
/conda/ @scbedd @xiangyan99 @lmazuel
854854

855855
# Add owners for notifications for specific pipelines
@@ -862,5 +862,14 @@
862862
/eng/emitter-package.json @mccoyp @catalinaperalta @iscai-msft @msyyc @ChenxiJiang333
863863
/eng/emitter-package-lock.json @mccoyp @catalinaperalta @iscai-msft @msyyc @ChenxiJiang333
864864

865+
# TypeSpec Python generated tests and regeneration workflow
866+
/eng/tools/emitter/ @tadelesh @msyyc @iscai-msft @lmazuel @lirenhe @ChenxiJiang333
867+
865868
/pylintrc @l0lawrence @scbedd @mccoyp
866869
/sdk/**/ci.yml @msyyc @lmazuel @scbedd
870+
871+
# Add Johnathan Walker as code owner for Event Hubs SDK
872+
/sdk/eventhub/azure-eventhub/* @j7nw4r
873+
874+
# Add Johnathan Walker as code owner for Service Bus SDK
875+
/sdk/servicebus/azure-servicebus/* @j7nw4r

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# AZURE SDK FOR PYTHON - COPILOT INSTRUCTIONS
22

3+
> **Note**: For general AI agent guidelines and repository overview, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-python/blob/main/AGENTS.md) at the repository root.
4+
35
---
46

57
## CORE PRINCIPLES
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: create-package-skill
3+
description: 'Interactive wizard that walks service teams through creating a package-specific skill for their Azure SDK package. Scans the package, detects customization patterns, scaffolds a SKILL.md with references, validates with vally lint, and registers in find-package-skill. WHEN: create package skill; add service skill; bootstrap skill for package; new package skill; skill for my SDK package; write skill for search; write skill for cosmos.'
4+
---
5+
6+
# Create Package Skill Wizard
7+
8+
> **Minimal beats comprehensive. Human-written beats auto-generated. Scaffold and iterate.**
9+
10+
> Skills encode tribal knowledge — the "I wish someone had told me" stuff that's hard to learn from just reading code. Focus on what's non-obvious and package-specific.
11+
12+
## Interaction Protocols
13+
14+
**CONFIRM Protocol** (asset-producing steps — creating files):
15+
1. PRESENT the proposed assets and explain why.
16+
2. ASK exactly one question: "Create now (recommended), edit first, or skip?"
17+
3. ACT immediately. Create → write files this turn. Edit → refine, re-ask. Skip → move on.
18+
19+
**DECIDE Protocol** (informational/correction steps — no files created):
20+
1. PRESENT the information or findings.
21+
2. ASK one specific question appropriate to the decision.
22+
3. PROCEED based on the answer.
23+
24+
One question at a time. Respect "skip" — never re-ask or defer.
25+
26+
## Wizard Flow
27+
28+
Run each phase in order. **Progressive loading:** Read only the current phase file.
29+
30+
| Phase | Description | Instructions |
31+
|---|---|---|
32+
| **Phase 0** | 🧭 Scan Package — detect architecture, customizations, key files | [phases/00-scan-package.md](phases/00-scan-package.md) |
33+
| **Phase 1** | 📝 Scaffold SKILL.md — generate skill with step-by-step post-regen workflow (Option A) or reference-manual structure (Option B) | [phases/01-scaffold-skill.md](phases/01-scaffold-skill.md) |
34+
| **Phase 2** | 📚 Generate References — create customizations.md (required) and optionally architecture.md | [phases/02-generate-references.md](phases/02-generate-references.md) |
35+
| **Phase 3** | Validate -- run vally lint | [phases/03-validate.md](phases/03-validate.md) |
36+
| **Phase 4** | 📋 Register — add to find-package-skill table | [phases/04-register.md](phases/04-register.md) |
37+
38+
## Guardrails
39+
40+
**Content:**
41+
- Every line must be non-obvious and package-specific. No generic Python/SDK boilerplate.
42+
- SKILL.md should be under 500 tokens (soft limit). Move details to references/.
43+
- References under 1000 tokens each. Split if larger.
44+
- Never duplicate what's already in `.github/copilot-instructions.md` or shared skills.
45+
46+
**Relationship to existing SDK tools:**
47+
- Package skills **complement** the Azure SDK MCP tools (`azsdk_package_generate_code`, `azsdk_package_build_code`, `azsdk_customized_code_update`, etc.) — they do NOT replace them.
48+
- MCP tools handle deterministic operations (generate, build, test). Package skills provide the reasoning context an agent needs to use those tools correctly for a specific package, plus the package-specific verification commands the tools do not know about.
49+
- Reference the existing tools for the overall workflow (e.g., "Run `tsp-client update` or `azsdk_package_generate_code`"), but DO include the copy-pasteable verification commands an agent needs: import smoke tests (`python -c "from ... import ..."`), `ApiVersion` reconciliation (`grep`, `python -c "import json; ..."`), diff commands (`git diff --name-only | grep ...`), and the package validation invocation (`azsdk_package_run_check with checkType="All"`).
50+
- Never paraphrase an MCP tool's entire contract. Do include the one-line invocations the agent will run.
51+
52+
**Structure:**
53+
- Skill directory: `sdk/<service>/<package-name>/.github/skills/<package-name>/`
54+
- Directory name MUST match `name` field in frontmatter (vally lint enforces this).
55+
- `name` is the distribution package name, e.g. `azure-search-documents`, `azure-ai-projects`, `azure-mgmt-appconfiguration`.
56+
- Use semicolons to separate trigger phrases in description (YAML-safe).
57+
58+
**Security:**
59+
- Never embed secrets or credentials in skill content.
60+
- Never instruct agents to bypass CI, pylint, mypy, pyright, or other gating tools.
61+
- Never instruct agents to edit files inside `_generated/` (or any file with the `"Code generated by Microsoft (R) Python Code Generator"` header) — always route through `_patch.py` or sibling hand-written modules.
62+
63+
## Key Principles (from eval data)
64+
65+
Our eval showed that skill **structure** matters more than **volume**:
66+
67+
| Pattern | Impact |
68+
|---|---|
69+
| Numbered step-by-step post-regen workflow (Option A) | Agent executes verification top-to-bottom without inventing steps |
70+
| Copy-pasteable verification commands (import smoke tests, `ApiVersion` reconciliation, git diff of generated operations/models) | Agent actually runs the checks instead of guessing whether customizations still work |
71+
| "Expose new generated methods through `_patch.py`" step (mixin inheritance / override / polymorphic / create-or-update / list / `__all__` re-export) | Agent wires new generated operations into the public surface instead of leaving them unreachable |
72+
| "Check `_patch.py` FIRST" directives | Changes agent default from "fix the error location" to "check the customization layer" |
73+
| Per-file `Depends On` / `Defines` / `After Regeneration, Verify` inventory in `customizations.md` | Agent can pinpoint exactly which generated symbol a breakage maps to |
74+
| Generated-file detection guidance (directory OR header comment) | Agent correctly identifies auto-generated files under both `_generated/` and inline layouts |
75+
| Async parity checklist | Agent remembers to mirror sync changes into `aio/` |
76+
| CHANGELOG / README update step | Prevents "silent" releases that ship new operations without docs |
77+
78+
## References (load on demand)
79+
80+
- [references/skill-template.md](references/skill-template.md) -- SKILL.md template with required sections
81+
- [references/validation-tools.md](references/validation-tools.md) -- vally lint, CI workflow setup
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Phase 0: Scan Package 🧭
2+
3+
> 📍 **Phase 0 — Scan Package** | Detect the package's architecture, customization patterns, and key files.
4+
5+
## Step 1 — Identify the Package
6+
7+
Ask the user: "Which SDK package should I create a skill for?"
8+
9+
The user should provide either:
10+
- A package name (e.g., `azure-search-documents`, `azure-ai-projects`, `azure-mgmt-appconfiguration`)
11+
- A path (e.g., `sdk/search/azure-search-documents`, `sdk/ai/azure-ai-projects`)
12+
13+
Resolve to the package root directory. Verify it exists and contains at least one of: `pyproject.toml`, `setup.py`, `tsp-location.yaml`, or a `swagger/README.md` (legacy autorest).
14+
15+
## Step 2 — Scan the Package
16+
17+
Scan the package using the checklist below. Use file_search / grep_search / read_file tools.
18+
19+
### Scan Checklist
20+
21+
1. **Code generation toolchain**:
22+
- `tsp-location.yaml` → TypeSpec-generated package. Note the spec directory and commit SHA.
23+
- `_metadata.json` → if present, record that `apiVersion` lives here (the skill will reconcile it against the hand-maintained `ApiVersion` enum).
24+
- `swagger/README.md` → legacy autorest-generated (mgmt packages typically).
25+
- Neither → hand-written package (rare).
26+
27+
2. **Namespace root**: Derive from the package name by replacing `-` with `/` (e.g., `azure-ai-projects``<package-path>/azure/ai/projects`). Verify the directory exists.
28+
29+
3. **Generated layout detection**:
30+
- If `<namespace-root>/_generated/` exists → **nested layout**. Generated files are confined to `_generated/`; everything else is hand-written/customization.
31+
- If `_generated/` is absent → **inline layout** (newer pattern). Generated files are identified by the header comment `"Code generated by Microsoft (R) Python Code Generator"` at the top of each file.
32+
33+
4. **Customizations** (`_patch.py` at each level):
34+
- `<namespace-root>/_patch.py` — top-level client customization
35+
- `<namespace-root>/models/_patch.py` — model customization
36+
- `<namespace-root>/operations/_patch.py` — sync operations customization
37+
- `<namespace-root>/aio/_patch.py` — async client customization
38+
- `<namespace-root>/aio/operations/_patch.py` — async operations customization
39+
40+
For each, check if it is **empty** (only copyright header, default docstring, empty `__all__`, empty `patch_sdk()`) or **non-empty** (defines classes/functions, or `__all__` has entries). Record the non-empty patches.
41+
42+
5. **Hand-written utility modules**: Glob all `.py` files under `<namespace-root>` excluding `_generated/`, `__init__.py`, `_version.py`, `_patch.py`. Classify each as generated (has the header) or custom. For custom utility modules, read the first few lines to get a one-line purpose.
43+
44+
6. **Public API surface**: Read each `__init__.py` (top-level, `models/`, `operations/`, `aio/`, `aio/operations/`). Note re-exports from `_patch.py` and any renames/omissions vs `_generated/__init__.py` (when nested layout).
45+
46+
7. **Async parity**: For each non-empty sync customization file, check whether the async counterpart exists under `aio/`. Record `identical`, `equivalent`, `divergent`, `sync-only`, or `async-only`.
47+
48+
8. **Service API versions**: Search for an `ApiVersion` enum or `api_version` constants under `<namespace-root>` (often inside `_patch.py` itself, not `_generated/`). Record the source file path, but do **not** hard-code the list of versions into the skill — point to the source file.
49+
50+
9. **Hand-authored named classes**: Grep for `class .*Buffered|class .*Batching|class .*Sender|class .*Paged|class .*PageIterator` under `<namespace-root>`. These are hand-authored utilities that the skill must name in its Customization Patterns Reference.
51+
52+
10. **Top public symbols (for import smoke tests)**: Read the top-level `__init__.py` and `aio/__init__.py`. Record up to 3–5 most important public names (clients, senders, key models/enums) so Phase 1 can generate accurate `python -c "from <ns> import <X>"` commands.
53+
54+
11. **Tests**: Check `tests/` directory. Look for `conftest.py`, `*test_base*.py`, `assets.json` (recorded tests via Test Proxy), `testpreparer*.py`. Note whether tests are live, recorded, or both.
55+
56+
12. **Documentation surfaces**: Check for `CHANGELOG.md` and `README.md` at the package root. Both are near-universal; the skill's Step 7 (Update Documentation and Samples) will reference them.
57+
58+
13. **Management vs data plane**: If package name starts with `azure-mgmt-` → management-plane rules apply (see copilot-instructions). Otherwise data-plane.
59+
60+
## Step 3 — Present Package Profile
61+
62+
Print a concise summary:
63+
64+
📋 **Package Profile**
65+
66+
| Field | Value |
67+
|---|---|
68+
| Package | `<package-name>` (e.g., `azure-ai-projects`) |
69+
| Path | `sdk/<service>/<package-name>` |
70+
| Plane | data / mgmt |
71+
| Generated | TypeSpec (`tsp-location.yaml`) / autorest (`swagger/README.md`) / hand-written |
72+
| Metadata | `_metadata.json` present: Y/N |
73+
| Layout | nested (`_generated/`) / inline (header-based) |
74+
| Non-empty `_patch.py` files | List which levels have customizations (top / models / operations / aio / aio/operations / indexes…) |
75+
| Custom utility modules | N hand-written `.py` files outside `_patch.py` |
76+
| Hand-authored named classes | e.g., `SearchIndexingBufferedSender`, `SearchItemPaged` (or `none`) |
77+
| Top public symbols | List of 3–5 names used for Phase 1 import smoke tests |
78+
| Public API surface | Notes on re-exports, renames, omissions |
79+
| Async parity | summary (identical / divergent / sync-only / async-only) |
80+
| `ApiVersion` enum | source file + present Y/N |
81+
| Tests | Unit: Y, Live: Y/N, Recorded (assets.json): Y/N |
82+
| Docs | `CHANGELOG.md`: Y/N, `README.md`: Y/N |
83+
| Suggested structure | Option A (step-by-step) / Option B (reference manual) |
84+
85+
## Step 4 — DECIDE
86+
87+
Question: "Does this profile look right? Anything to add or correct?"
88+
89+
📍 **Phase 0 complete** | Package scanned | Next: Phase 1
90+
91+
---
92+
## → Next: Phase 1 — Scaffold SKILL.md
93+
Read [01-scaffold-skill.md](01-scaffold-skill.md) and begin immediately.

0 commit comments

Comments
 (0)