I've the following repo structure:
libs/
- l1/
- pyproject.toml
- l2/
- pyproject.toml
batch/
- b1/
- pyproject.toml
- b2/
- pyproject.toml
pipelines/
- p1/
- pyproject.toml
- p2/
- pyproject.toml
pyproject.toml
And the following pre-commit hook configured:
---
files: .(yaml|yml|py|toml)$
repos:
- repo: https://github.com/jazzband/pip-tools
rev: 7.3.0
hooks:
- id: pip-compile
name: Run pip-compile for 'prod' env.
args:
- -o
- pyproject.lock
- --generate-hashes
- --strip-extras
The problem is it only picks the repo root's pyproject.toml file. All the others are skipped? Why is that? I've tried using files
options to no avail. What is the problem here?
there are two separate
files
configurations -- you've overridden the wrong one.the
files
at the top level is the whole repository filter -- it's usually used to narrow down to a specific scope if you need it (and uncommon in most uses ofpre-commit
)the
files
you are trying to overwrite comes originally from the hook itself (which setsfiles: ^requirements\.(in|txt)$
) -- to override that you need to put yourfiles
inside the hook mapping:disclaimer: I wrote pre-commit