一键导入
fix-mypy
Automatically fix mypy type checking issues in any Azure SDK for Python package following Azure SDK Python patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Automatically fix mypy type checking issues in any Azure SDK for Python package following Azure SDK Python patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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.
Emit the azure-ai-projects Python SDK from TypeSpec, apply post-emitter fixes, and create a Pull Request. WHEN: "emit SDK from TypeSpec", "generate azure-ai-projects SDK", "update azure-ai-projects from TypeSpec", "emit from TypeSpec", "regenerate azure-ai-projects". DO NOT USE FOR: other Azure SDK packages, manual code edits without TypeSpec. INVOKES: PostEmitter.ps1 script, git commands, gh CLI for PR creation.
Update CHANGELOG.md by comparing public APIs between the current branch and the latest released version on PyPI. WHEN: "update changelog", "generate changelog", "add changelog entry", "what changed in this version". DO NOT USE FOR: other Azure SDK packages. INVOKES: PyPI API, GitHub API (for tags), file operations.
Drafts concise team status updates with progress, plans, and blockers.
Create and test a classify-and-route Azure AI Content Understanding pipeline for packets that contain multiple document types (e.g. invoice + bank statement + loan application in one PDF). Walks per-type schema authoring → outer classifier wiring → batch test → category-aware stdout summary using the typed ContentUnderstandingClient. Use when the user has mixed-document packets.
Iteratively author and test a custom Azure AI Content Understanding analyzer for a folder of **document** files (PDFs, page images) of a single type. Walks layout extraction → schema authoring → validation → batch test → agent review → refine cycle using the typed ContentUnderstandingClient. Document modality only — audio, video, and image analyzers are planned for a later update. Use when the user wants to author a custom analyzer for invoices, contracts, forms, or any other single-type document set.
| name | fix-mypy |
| description | Automatically fix mypy type checking issues in any Azure SDK for Python package following Azure SDK Python patterns. |
This skill automatically fixes mypy type checking errors in any Azure SDK for Python package by analyzing existing code patterns and applying fixes with 100% confidence.
Intelligently fixes mypy issues by:
Command:
cd <package-path>
azpysdk --isolate mypy .
Note:
azpysdk mypyruns with a pinned version of mypy at the package level only. To focus on specific files, run the full check and filter the output by file path.
Using Latest MyPy:
azpysdk --isolate next-mypy .
Use
azpysdk next-mypyto run with the latest version of mypy. This is useful for catching issues that may be flagged by newer mypy versions.
Check if user provided in their request:
https://github.com/Azure/azure-sdk-for-python/issues/... in user's message)sdk/storage/azure-storage-blob or azure-storage-blob)If both GitHub issue URL and package path are missing: Ask: "Please provide either the GitHub issue URL or the package path (e.g. sdk/storage/azure-storage-blob) for the mypy type checking problems you want to fix."
If a GitHub issue URL is provided: Read the issue to understand which package and files/modules are affected, and the specific error codes to fix.
If only a package path is provided: Run mypy checks directly on the package.
If virtual environment is missing: Ask: "Do you have an existing virtual environment path, or should I create 'env'?"
IMMEDIATELY activate the virtual environment before ANY other command:
# Activate the provided virtual environment (e.g., env, venv)
.\<venv-name>\Scripts\Activate.ps1
# If creating new virtual environment
python -m venv env
.\env\Scripts\Activate.ps1
⚠️ IMPORTANT: ALL subsequent commands MUST run within the activated virtual environment. Never run commands outside the venv.
# Navigate to the package directory (within activated venv)
cd <package-path>
# Install dev dependencies from dev_requirements.txt (within activated venv)
pip install -r dev_requirements.txt
# Install the package in editable mode (within activated venv)
pip install -e .
Based on the GitHub issue details, determine which files to check:
Option A - Run mypy on the package and filter output:
# Ensure you're in the package directory (within activated venv)
cd <package-path>
# Run mypy on the full package, then filter output for files from the issue
azpysdk --isolate mypy .
# Review output for errors in the specific files/modules mentioned in the issue
Option B - Check modified files (if no specific target):
git diff --name-only HEAD | Select-String "<package-path>"
git diff --cached --name-only | Select-String "<package-path>"
⚠️ Ensure virtual environment is still activated before running:
# Navigate to the package directory
cd <package-path>
# Run mypy on the package (within activated venv)
azpysdk --isolate mypy .
# Filter output for the specific files/modules from the issue
Parse the mypy output to identify:
Before fixing, search the codebase for how similar types are annotated:
# Example: Search for similar function signatures
grep -r "def similar_function" <package-path>/ -A 5
# Search for type imports
grep -r "from typing import" <package-path>/
Use the existing type annotation patterns to ensure consistency.
ALLOWED ACTIONS: Fix type errors with 100% confidence Use existing type annotation patterns as reference Follow Azure SDK Python type checking guidelines Add missing type hints Fix incorrect type annotations Make minimal, targeted changes
FORBIDDEN ACTIONS:
Fix errors without complete confidence
Create new files for solutions
Import non-existent types or modules
Add new dependencies or imports outside typing module
Use # type: ignore without clear justification
Change code logic to avoid type errors
Delete code without clear justification
Re-run mypy to ensure:
Provide a summary:
⚠️ REQUIRED when a GitHub issue URL was provided: You MUST create a pull request after validating fixes. This is not optional.
Create a pull request with a descriptive title and body referencing the issue. Include what was fixed and confirm all mypy checks pass. The PR title should follow the format: "fix(): Resolve mypy type errors (#)".
Optional[X] instead of X | None)# type: ignore unless absolutely necessary and document why