-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Summary
The repository uses npm run scripts as the canonical interface for all validation commands (lint:md, lint:ps, test:ps, etc.). Python has no equivalent entries, meaning developers and CI workflows have no standardized way to run Python linting or testing. Adding lint:py, lint:py:fix, and test:py scripts creates developer-facing commands that mirror the existing patterns.
Context
The codebase convention documented in copilot-instructions.md states that all scripts used by the codebase have an npm run script for ease of use. The Coding Agent environment section lists specific npm run commands that agents should use for validation. Without Python entries, neither human developers nor AI agents have discoverable commands for Python quality gates.
These scripts should invoke ruff for linting and pytest for testing via uv run to ensure the correct virtual environment is used. The lint:all composite script should also be updated to include lint:py.
Architecture: Multi-Skill Discovery
Each Python skill maintains its own pyproject.toml. Rather than hardcoding paths, npm scripts should use find-based discovery to automatically locate and iterate over all Python skill directories. This scales to N skills without per-skill configuration changes.
Changes Required
| File | Change |
|---|---|
package.json |
Add lint:py script using find-based discovery |
package.json |
Add lint:py:fix script using find-based discovery |
package.json |
Add test:py script using find-based discovery |
package.json |
Update lint:all to include lint:py in the chain |
Example entries using dynamic discovery:
{
"lint:py": "find .github/skills -name pyproject.toml -execdir uv run ruff check . ';'",
"lint:py:fix": "find .github/skills -name pyproject.toml -execdir uv run ruff format . ';'",
"test:py": "find .github/skills -name pyproject.toml -execdir uv run pytest ';'"
}The find -execdir pattern runs each command in the directory containing the pyproject.toml, ensuring uv resolves the correct virtual environment per skill. Adding a new Python skill with a pyproject.toml causes it to be discovered by all scripts automatically.
Acceptance Criteria
-
npm run lint:pyexecutes ruff check against Python files in all skill directories -
npm run lint:py:fixapplies auto-fixable ruff corrections across all skill directories -
npm run test:pyexecutes pytest against Python test files in all skill directories -
npm run lint:allincludeslint:pyin its execution chain - All three commands produce clear output and exit with appropriate codes
- Commands work in both devcontainer and Copilot Agent environments (requires uv to be installed)
- Adding a new Python skill with
pyproject.tomlis automatically discovered without script changes
Dependencies
- Requires
uvto be available in the execution environment (addressed by feat(devcontainer): Add Python development extensions and uv package manager #887 for devcontainer, feat(ci): Add uv and Python package sync to copilot-setup-steps #888 for Copilot Agent) - Python skill with
pyproject.tomlmust exist for commands to have targets (PR feat(skills): add PowerPoint automation skill with YAML-driven deck generation #868)
Related
- PR feat(skills): add PowerPoint automation skill with YAML-driven deck generation #868 — PowerPoint automation skill (first Python skill)
- feat(ci): Add Python file extensions to copyright/SPDX header validation #883 — Copyright/SPDX header validation for Python
- feat(ci): Add Python to CodeQL analysis language matrix #884 — CodeQL Python integration
- feat(deps): Add uv ecosystem to Dependabot configuration #885 — Dependabot uv ecosystem
- feat(skills): Mandate unit testing, extend CI coverage, and document language support process #634 — Prior CI coverage expansion work (closed)