ci(hooks): use managed Python environments - #305
Conversation
# 🔧 CI/CD - Run check-conflict-markers and format-ascii-boxes in pre-commit-managed Python environments. - Explicitly select Python 3 for both local hooks.
There was a problem hiding this comment.
🟡 Changes recommended
The config still runs the gitleaks wrapper via python ..., so pre-commit run --all-files can still fail on systems without a python executable even after this update.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the repository’s local pre-commit hooks so they run in pre-commit-managed Python 3 environments instead of relying on a python executable being present on the user’s PATH.
Changes:
- Switch
check-conflict-markerslocal hook fromlanguage: systemtolanguage: python. - Switch
format-ascii-boxeslocal hook fromlanguage: systemtolanguage: python. - Pin both hooks to
language_version: python3so pre-commit provisions a Python 3 interpreter for them.
File summaries
| File | Description |
|---|---|
| .pre-commit-config.yaml | Moves two local hooks to pre-commit-managed Python environments (Python 3) to avoid relying on python on PATH. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - id: format-ascii-boxes | ||
| name: format-ascii-boxes | ||
| entry: python .pre-commit-hooks/format_ascii_boxes.py | ||
| language: system | ||
| language: python | ||
| language_version: python3 |
rai-studio-bot
left a comment
There was a problem hiding this comment.
已审查完整 diff 及两个 hook 的实现,未发现需要阻塞合入的问题。改动范围与 PR 描述一致,Pre-commit Checks 已通过;单元测试矩阵仍在运行。本地未重跑检查,多节点 GPU 集成测试因缺少相应硬件未执行。
What
Run the
check-conflict-markersandformat-ascii-boxeslocal hooks in pre-commit-managed Python 3 environments.Why
Both hooks invoke
python. Withlanguage: system, they depend on apythonexecutable on the caller's PATH, which can fail on systems that only exposepython3.How
Set
language: pythonandlanguage_version: python3for both hooks so pre-commit provisions their Python environments.Testing
pre-commit run --all-files --show-diff-on-failurepassed with the existing pre-commit environment's bin directory on PATH.pytest tests/was not run because this change only updates hook configuration. Multi-node GPU integration tests were skipped because they require multi-node GPU hardware and this change does not affect training. New tests and documentation updates are not applicable.pre-commit run --all-filespassespytest tests/)Type of Change
Screenshots / Logs