Files
miles/.pre-commit-config.yaml
T
fzyzcjy 522f77ad12 Pin what a typical run renders, and the commands one launch runs
Every op so far pinned one template's behaviour in isolation; this pins what
they add up to. The values are written by hand rather than by the launcher, so
the snapshot says what the chart does and not what the launcher happens to ask
it for.

A launch is also a sequence of helm and kubectl calls, and a refactor that
quietly reorders or drops one of them would still pass every unit test.
Recording the whole sequence for a typical run makes that visible in review.
2026-09-15 17:13:57 +08:00

95 lines
3.1 KiB
YAML

default_language_version:
python: python3
# The vendored upstream module stays byte-diffable against its source; keep
# formatters and linters away so upstream-tracking diffs remain minimal.
exclude: '^miles/utils/chat_template_utils/templates/encoding_dsv32\.py$'
ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
args: ['--allow-multiple-documents']
exclude: '^charts/.*/templates/'
- id: check-case-conflict
- id: detect-private-key
- id: check-added-large-files
args: ['--maxkb=1000']
- id: requirements-txt-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.7
hooks:
- id: ruff-check
args: [ --fix ]
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.2
hooks:
- id: autoflake
args: [--remove-all-unused-imports, --in-place]
- repo: https://github.com/pycqa/isort
rev: 5.13.2 # 选一个稳定版本
hooks:
- id: isort
args:
- "--profile=black" # 常见:与 Black 对齐风格
- "--filter-files" # 忽略已在 .gitignore 的文件
additional_dependencies: [] # 需要插件时在这里加
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
name: Format code
additional_dependencies: ['click==8.0.2']
- repo: local
hooks:
- id: sync-example-docs
name: Mirror examples/ READMEs into the docs site
language: system
entry: python3 scripts/tools/sync_example_docs.py
files: '^(examples/.*README\.md|docs/examples/.*|docs/docs\.json|scripts/tools/sync_example_docs\.py)$'
pass_filenames: false
- id: ban-docs-nav-group-root
name: Ban group `root` in docs navigation (put the landing page first in `pages` with `sidebarTitle Overview` instead; see docs/README.md)
language: pygrep
entry: '"root":'
files: ^docs/docs\.json$
- id: helm-lint
name: helm lint every chart
language: system
entry: python3 tools/kubernetes/lint_charts.py
pass_filenames: false
files: '^charts/'
- id: ban-mpu-get
name: Ban direct mpu.get_* calls (use ParallelState)
language: pygrep
entry: 'mpu\.get_'
types: [python]
exclude: '(backends/megatron_utils/parallel\.py|tools/convert_to_hf\.py|miles_plugins/|examples/)'
- id: ban-bare-auto-loaders
name: Ban bare Auto{Config,Tokenizer}.from_pretrained (use load_hf_config / load_tokenizer)
language: pygrep
entry: '(AutoConfig|AutoTokenizer)\.from_pretrained'
types: [python]
exclude: '(miles/utils/hf_config\.py|miles/utils/processing_utils\.py|tests/|test_utils/|miles_plugins/|examples/)'
- id: ban-huggingface-cli
name: Ban deprecated huggingface-cli (use hf)
language: pygrep
entry: 'huggingface-cli'
types: [python]