Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 8 additions & 166 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,169 +1,11 @@
# AZURE SDK FOR PYTHON - COPILOT INSTRUCTIONS
# Repository guidance has moved

> **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.
Agent-facing guidance for this repository lives in
[`AGENTS.md`](../AGENTS.md) at the repository root.

---
`AGENTS.md` is a resolver that points to canonical task skills, path-scoped
reviewer instructions, package-specific skills, and contributor documentation.
Start there rather than duplicating guidance in this file.

## CORE PRINCIPLES

### RULE 1: DO NOT REPEAT INSTRUCTIONS
**NEVER repeat instructions when guiding users. Users should follow instructions independently.**

### RULE 2: REFERENCE OFFICIAL DOCUMENTATION
**ALWAYS** reference the [Azure SDK Python Design Guidelines](https://azure.github.io/azure-sdk/python_design.html)
- Link to specific pages when answering guidelines questions
- Use this as the authoritative source for SDK development guidance

### RULE 3: VERIFY ENVIRONMENT FIRST
**REQUIRED CONDITIONS:**
- To use Azure MCP tool calls, users must have PowerShell installed. Provide [PowerShell installation instructions](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) if not installed, and recommend restarting the IDE to start the MCP server.
- When using Copilot from Visual Studio or VS Code (not applicable when using Coding Agent on Github.com):
- **Always run** the [`azsdk_verify_setup`](../eng/common/instructions/azsdk-tools/verify-setup.instructions.md) tool first to validate the user's development environment for SDK MCP tools.
- **Do not proceed** with any other tool execution until this step is complete.
- **Skip this check only** for queries that do not require tool execution.

---

## PYLINT OPERATIONS

### RUNNING PYLINT

**REFERENCE DOCUMENTATION:**
- [Official pylint guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/pylint_checking.md)
- [Tool usage guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/tool_usage_guide.md)

**COMMAND:**
```bash
azpysdk pylint .
```

### FIXING PYLINT WARNINGS

**REFERENCE SOURCES:**
- [Azure pylint guidelines](https://github.com/Azure/azure-sdk-tools/blob/main/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md)
- [Pylint documentation](https://pylint.readthedocs.io/en/stable/user_guide/checkers/features.html)

**ALLOWED ACTIONS:**
✅ Fix warnings with 100% confidence
✅ Use existing file for all solutions
✅ Reference official guidelines

**FORBIDDEN ACTIONS:**
❌ Fix warnings without complete confidence
❌ Create new files for solutions
❌ Import non-existent modules
❌ Add new dependencies/imports
❌ Make unnecessary large changes
❌ Change code style without reason
❌ Delete code without clear justification

---

## MYPY OPERATIONS

### RUNNING AND FIXING MYPY

**REFERENCE DOCUMENTATION:**
- [Tool usage guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/tool_usage_guide.md)
- [MyPy fixing guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/static_type_checking_cheat_sheet.md)

**REQUIREMENTS:**
- Use Python 3.10 compatible environment
- Follow official fixing guidelines
- Run `azpysdk mypy .` from the package directory

---

## Python SDK Health tool

- Use the azure-sdk-python-mcp mcp tool to lookup a library's health status.
- Always include the date of last update based on the Last Refresh date.
- Explanation of statuses can be found here: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/repo_health_status.md
- Release blocking checks are MyPy, Pylint, Sphinx, and Tests - CI. These checks should all PASS. If not PASS, mention that the library is blocked for release.
- If links are available in the table, make the statuses (e.g. PASS, WARNING, etc) you report linked. Avoid telling the user to check the links in the report themselves.
- Don't share information like SDK Owned

### Example

As of <Last Refresh date>, here is the health status for azure-ai-projects:

Overall Status: ⚠️ NEEDS_ACTION

✅ Passing Checks:

Pyright: PASS
Sphinx: PASS
Type Checked Samples: ENABLED
SLA Questions and Bugs: 0

⚠️ Areas Needing Attention:

Pylint: WARNING
Tests - Live: ❓ UNKNOWN
Tests - Samples: ❌ DISABLED
Customer-reported issues: 🔴 5 open issues

❌ Release blocking

Mypy: FAIL
Tests - CI: FAIL

This library is failing two release blocking checks - Mypy and Tests - CI. The library needs attention primarily due to Pylint warnings, disabled sample tests, and open customer-reported issues.

---

## Local SDK Generation and Package Lifecycle (TypeSpec)

### AUTHORITATIVE REFERENCE
For all TypeSpec-based SDK workflows (generation, building, validation, testing, versioning, and release), follow #file:skills/azsdk-common-generate-sdk-locally/SKILL.md

### DEFAULT BEHAVIORS
- **Repository:** Use the current workspace as the local SDK repository unless the user specifies a different path.
- **Configuration:** Identify `tsp-location.yaml` from files open in the editor. If unclear, ask the user.

### PYTHON-SPECIFIC RULES
- **Skip build step:** Python packages do not require compilation. After generation, proceed directly to validation and tests.

### REQUIRED CONFIRMATIONS
Ask the user for clarification if repository path or configuration file is ambiguous.

---

## MGMT SDK Code Review Rules

### SCOPE
These rules apply to management-plane SDK packages located at `sdk/*/azure-mgmt-*/`.

### REVIEW EXCLUSIONS
- **Skip** the `generated_samples/` and `generated_tests/` folders entirely — do not review generated sample or test code.
- **Skip** source code under `azure/mgmt/**/` **except** `_client.py` — only review `_client.py` among the generated source files.

### VERSION CONSISTENCY
- The version string in `_version.py` **must** match the latest version listed in `CHANGELOG.md`.

### CHANGELOG DATE
- If the release date of the latest version in `CHANGELOG.md` is **more than 3 weeks in the future** from the current date, remind the author to verify and update the date.

### PYPROJECT.TOML STABILITY FLAGS
- **Stable version** (version string does **not** contain `b`):
- `is_stable` in `pyproject.toml` must be `true`
- `classifiers` must include `"Development Status :: 5 - Production/Stable"`
- **Preview version** (version string contains `b`):
- `is_stable` in `pyproject.toml` must be `false`
- `classifiers` must include `"Development Status :: 4 - Beta"`

### CLIENT SIGNATURE
- The `__init__` method of the client class in `_client.py` must include the parameters `credential`, `subscription_id`, and `base_url` **in that order**. Default values are not checked.
- If `subscription_id` is **not** present in the client's `__init__` signature, `pyproject.toml` must contain `no_sub = true`. If it does not, hint the user to add `no_sub = true` in `pyproject.toml` and regenerate the SDK.

### CLIENT NAME CONSISTENCY
- The client class name in `_client.py`, the client name referenced in `README.md`, and the `title` value in `pyproject.toml` must all be the same.

### README CODE SNIPPETS
- Code snippets in `README.md` must follow the real client class signatures and usage patterns. Verify that sample code matches the actual client API.

---

## SDK release

For detailed workflow instructions, see [SDK Release](skills/azsdk-common-sdk-release/SKILL.md).
This lightweight redirect remains for tools that discover
`.github/copilot-instructions.md` by its conventional path.
51 changes: 51 additions & 0 deletions .github/instructions/reviewer/mgmt-sdk.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
applyTo: "sdk/*/azure-mgmt-*/**"
description: "Azure management-plane SDK review rules for generated source, versions, metadata, and client documentation."
---

# Management SDK review rules

Apply these rules only to management-plane packages under
`sdk/*/azure-mgmt-*/`. Only report issues introduced by the change under
review.

## Review scope

- Skip `generated_samples/` and `generated_tests/`.
- Skip generated source under `azure/mgmt/**/` except `_client.py`.
- Review package metadata, `CHANGELOG.md`, `README.md`, and the public client
signature where relevant.

## Version consistency

- The version in `_version.py` must match the latest version in `CHANGELOG.md`.
- If `_metadata.json` has an `apiVersion` containing `preview`, `_version.py`
must contain a preview version such as `1.0.0b1`, not a stable version such
as `1.0.0`.
- If the latest `CHANGELOG.md` release date is more than three weeks in the
future, ask the author to verify the date.

## Package stability metadata

For a stable version, whose version string does not contain `b`:

- `pyproject.toml` must set `is_stable = true`.
- Classifiers must include
`"Development Status :: 5 - Production/Stable"`.

For a preview version, whose version string contains `b`:

- `pyproject.toml` must set `is_stable = false`.
- Classifiers must include `"Development Status :: 4 - Beta"`.

## Client consistency

- The client `__init__` signature in `_client.py` must contain `credential`,
`subscription_id`, and `base_url` in that order. Default values are not part
of this check.
- If `subscription_id` is absent, `pyproject.toml` must contain
`no_sub = true`. Otherwise, recommend adding it and regenerating the SDK.
- The client class name in `_client.py`, the client name used in `README.md`,
and the `title` in `pyproject.toml` must match.
- README code snippets must follow the actual client signature and usage
pattern.
18 changes: 18 additions & 0 deletions .github/prompts/check-package-health.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
mode: "agent"
description: "Report the Azure SDK for Python health status of a package."
---

# Check package health

Use the available Azure SDK Python package-health tool to retrieve the package
health report.

- Include the report's **Last Refresh** date.
- Interpret statuses according to
[`doc/repo_health_status.md`](../../doc/repo_health_status.md).
- Treat MyPy, Pylint, Sphinx, and Tests - CI as release-blocking checks. State
clearly when any of them is not passing and the package is blocked.
- Link reported statuses when the health report provides links.
- Do not expose internal ownership fields such as `SDK Owned`.
- Separate passing checks, areas needing attention, and release blockers.
9 changes: 5 additions & 4 deletions .github/prompts/check-package-readiness.prompt.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
mode: 'agent'
tools: ['CheckPackageReleaseReadiness']
description: 'This prompt is designed to check the release readiness of a SDK package.'
description: 'Check the release readiness of an SDK package.'
---
## Goal
Check the release readiness of an SDK package by collecting the required information from the user and executing the readiness check.
Check the release readiness of an SDK package using the
`azsdk-common-sdk-release` skill.

## Instructions
1. **Collect Required Information**:
Expand All @@ -17,7 +17,8 @@ Check the release readiness of an SDK package by collecting the required informa
- Go

2. **Execute Readiness Check**:
- Use the `CheckPackageReleaseReadiness` tool with the provided package name and selected language
- Follow `.github/skills/azsdk-common-sdk-release/SKILL.md`.
- Use `azure-sdk-mcp:azsdk_release_sdk` with `checkReady: true`.
- Do not check for existing pull requests to run this step.
- Do not ask the user to create a release plan to run this step.

Expand Down
3 changes: 2 additions & 1 deletion .github/skills/create-package-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Run each phase in order. **Progressive loading:** Read only the current phase fi
- Every line must be non-obvious and package-specific. No generic Python/SDK boilerplate.
- SKILL.md should be under 500 tokens (soft limit). Move details to references/.
- References under 1000 tokens each. Split if larger.
- Never duplicate what's already in `.github/copilot-instructions.md` or shared skills.
- Never duplicate what's already in `AGENTS.md`, shared skills, or path-scoped
reviewer instructions.

**Relationship to existing SDK tools:**
- 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ Scan the package using the checklist below. Use file_search / grep_search / read

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.

13. **Management vs data plane**: If package name starts with `azure-mgmt-` → management-plane rules apply (see copilot-instructions). Otherwise data-plane.
13. **Management vs data plane**: If package name starts with `azure-mgmt-` →
management-plane rules apply (see
`.github/instructions/reviewer/mgmt-sdk.instructions.md`). Otherwise
data-plane.

## Step 3 — Present Package Profile

Expand Down
Loading