Metadata-Version: 2.4
Name: update-mypy-hook
Version: 0.3.0
Summary: Update the additional dependencies of mypy pre-commit hook from uv.lock
Project-URL: Source, https://github.com/H4rryK4ne/update-mypy-hook
Project-URL: Changes, https://github.com/H4rryK4ne/update-mypy-hook/blob/develop/CHANGELOG.md
Author-email: HarryKane <harrykane@gmx.de>
License-Expression: GPL-3.0-or-later
License-File: license.txt
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: ruamel-yaml
Requires-Dist: typing-extensions; python_version < '3.11'
Requires-Dist: uv>=0.7.0
Description-Content-Type: text/markdown

# Update mypy pre-commit hook

This script uses [`uv`](https://docs.astral.sh/uv) to update the `additional_dependencies` of the
[mypy pre-commit hook](https://github.com/pre-commit/mirrors-mypy).

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
```shell
pip install update-mypy-hook
```
or with uv
```shell
uv add update-mypy-hook --group dev
```

If `uv` is not part of your setup, use the extra
```shell
pip install update-mypy-hook[uv]
```

## Using update-mypy-hook

Run in your python project root folder
```shell
update-mypy-hook --help
```

## Pre-commit hook
Add this to your `.pre-commit-config.yaml`

```yaml
- repo: https://github.com/H4rryK4ne/update-mypy-hook
  rev: v0.2.0
  hooks:
  - id: update-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:
```text
  -h, --help            show this help message and exit
  -g GROUP, --group GROUP
                        Dependency group to include. Can be used multiple times (default: mypy)
  --no-groups           Do not include any dependency groups.
  -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 PROJECT_PATH, --project-path PROJECT_PATH
                        Path to python project. 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)
```
