A pre-commit hook to keep mypy hook's additional_dependencies in sync with poetry by update .pre-commit-config.yaml
Add the hook to your .pre-commit-config.yaml
:
- hooks:
- id: sync-mypy-additional-dependencies
repo: https://github.com/martin-schulze-e2m/pre-commit-mypy-poetry-sync-hook
rev: v0.2.0
These can be added as args to the hook:
- hooks:
- id: sync-mypy-additional-dependencies
args: --groups lint # only use dependencies from the lint group
repo: https://github.com/martin-schulze-e2m/pre-commit-mypy-poetry-sync-hook
rev: v0.2.0
All parameters are optional and have mostly sane defaults.
Running sync-mypy-additinal-dependencies --help
(with this project installed!) will list all parameters.
The most important are as follows
List of poetry groups to sync dependencies for
default: all non-optional groups
Strings that should be added as entries to mypy hook's additional_dependencies
before the dependencies from poetry.
Can be repeated to add multiple entries.
This can be used to change the index used by pip: (See pre-commit/pre-commit#1316 (comment))
- hooks:
- id: sync-mypy-additional-dependencies
args: --extra_additional_dependencies "--index-url=<your private index>"
repo: https://github.com/martin-schulze-e2m/pre-commit-mypy-poetry-sync-hook
rev: v0.2.0
Path to the .pre-commit-config.yaml
that should be patched.
default: .pre-commit-config.yaml
Path to the pyproject.toml
to get the dependencies from.
default: pyproject.toml