Update the additional dependencies of mypy pre-commit hook from uv.lock
Project description
Update mypy pre-commit hook
This script uses uv to update the additional_dependencies of the
mypy pre-commit hook.
⚠️ WARNING ⚠️
This will rewrite your
.pre-commit-config.yamland you will lose all comments.
With uv export it will generate a list of all dependencies required to run mypy.
By default, it assumes that an uv dependency group, called mypy, exists and contains all additional dependencies
(besides the project dependencies) to successfully run type checking.
The group(s) may only contain the direct dependencies. Transitive dependencies are derived by uv automatically.
The dependency group(s) can be overwritten by -g/--group option.
Installation
If you have installed uv on your machine or is already part of your dependencies you can run
pip install update-mypy-hook
or with uv
uv add update-mypy-hook --group dev
If uv is not part of your setup, use the extra
pip install update-mypy-hook[uv]
Using update-mypy-hook
Run in your python project root folder
update-mypy-hook --help
Pre-commit hook
Add this to your .pre-commit-config.yaml
- repo: https://github.com/H4rryK4ne/update-mypy-hook
rev: 0.1.0
hooks:
- id: update-dependency-mypy-hook
additional_dependencies:
- uv # if uv is not installed on every developer's system
args:
- --extra-excluded-package=some_package
- --extra-excluded-package=some_other_package
Options:
-g GROUP, --group GROUP
Dependency group to include. Can be used multiple times (default: mypy)
-c PRE_COMMIT_CONFIG_PATH, --pre-commit-config-path PRE_COMMIT_CONFIG_PATH
Path to .pre-commit-config.yaml (default: .pre-commit-config.yaml)
-p PYPROJECT_PATH, --pyproject-path PYPROJECT_PATH
Path to pyproject.toml. Only needed if not in project root.
--excluded-package PACKAGE
Package excluded in the additional_dependencies. Can be used multiple times (default: mypy, mypy-extensions, tomli, typing-extensions)
-x PACKAGE, --extra-excluded-package PACKAGE
Additional package excluded from additional_dependencies. Extends the --excluded-package option. Can be used multiple times.
--yaml-width YAML_WIDTH
maximum width of yaml output (default: 120)
--yaml-indent YAML_INDENT
number of spaces to indent (default: 2)
--yaml-default-flow-style, --no-yaml-default-flow-style
use default flow style (default: False)
--yaml-sort-keys, --no-yaml-sort-keys
sort keys in yaml output (default: False)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file update_mypy_hook-0.1.0.tar.gz.
File metadata
- Download URL: update_mypy_hook-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6da0da6d631bab9e4232ab6e34595ef7364e6e49cf8bfb8b9888aac2903becf3
|
|
| MD5 |
9b3063e3738dce399bbbfb29a5890b46
|
|
| BLAKE2b-256 |
82af1c1433b3712fb519467e6c4eff1ce7db32ad7129526d2c003808b429567b
|
File details
Details for the file update_mypy_hook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: update_mypy_hook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f31193314c01c0fddb8601fc92990afe3958b13ba60e639ad39e92c90f02f60
|
|
| MD5 |
ba52325e40047a89e143fc031e9294bb
|
|
| BLAKE2b-256 |
2c4ce95566f5829d5d9277d509e476cf5b9228259596858a419c8a80d87078c3
|