-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: Fix prek runner duplication and add skills #3791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Fix prek runner duplication and add skills #3791
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Motivation and Context
Fixes a bug in the prek setup, and adds skills explicitly instead of through instructions.
Description
Contribution Checklist