Python: Fix prek runner duplication and add skills#3791
Merged
eavanvalkenburg merged 6 commits intomicrosoft:mainfrom Feb 10, 2026
Merged
Python: Fix prek runner duplication and add skills#3791eavanvalkenburg merged 6 commits intomicrosoft:mainfrom
eavanvalkenburg merged 6 commits intomicrosoft:mainfrom
Conversation
When a core package file changed, run_tasks_in_changed_packages.py ran fmt, lint, and pyright in ALL 22 packages (66 tasks). Only type-checking tasks (pyright, mypy) need to propagate to all packages since type changes in core affect downstream packages. File-local tasks (fmt, lint) only need to run in packages with actual file changes. This reduces a core-only change from 66 tasks to 24 tasks (2 local + 22 pyright). Also adds no-commit-to-branch builtin hook to protect the main branch from direct commits.
Add 5 skills to python/.github/skills/ following the Agent Skills format: - python-development: coding standards, type annotations, docstrings, logging - python-testing: test structure, fixtures, running tests, async mode - python-code-quality: linting, formatting, type checking, prek hooks, CI - python-package-management: monorepo structure, lazy loading, versioning - python-samples: sample structure, PEP 723, documentation guidelines
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python developer experience by fixing how prek determines which package tasks to run (avoiding unnecessary cross-package runs) and by moving detailed contributor guidance into explicit Copilot “skills” documents.
Changes:
- Update
run_tasks_in_changed_packages.pyso core changes trigger type-checking across all packages, while fmt/lint remain scoped to changed packages. - Add Python Copilot skill documents under
python/.github/skills/and updatepython/AGENTS.mdto reference them. - Add a pre-commit hook to prevent committing directly to
main, and simplify Python Copilot instructions to point at the skill docs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| python/scripts/run_tasks_in_changed_packages.py | Splits “local” vs “type-check” tasks so core changes only fan out type-checking to all packages. |
| python/AGENTS.md | Points contributors to skill docs and adds quick references/structure notes. |
| python/.pre-commit-config.yaml | Adds branch protection hook (no-commit-to-branch) for main. |
| python/.github/skills/python-development/SKILL.md | New skill: Python coding standards and conventions. |
| python/.github/skills/python-testing/SKILL.md | New skill: testing practices and commands. |
| python/.github/skills/python-code-quality/SKILL.md | New skill: lint/format/typecheck/prek/CI guidance. |
| python/.github/skills/python-package-management/SKILL.md | New skill: monorepo package management and lazy-loading pattern. |
| python/.github/skills/python-samples/SKILL.md | New skill: sample structure and PEP 723 guidance. |
| python/.github/instructions/python.instructions.md | Updated Copilot instructions to defer to AGENTS.md + skills. |
westey-m
approved these changes
Feb 10, 2026
markwallace-microsoft
approved these changes
Feb 10, 2026
Member
westey-m
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Fixes a bug in the prek setup, and adds skills explicitly instead of through instructions.
Description
Contribution Checklist