Skip to main content

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.yaml and 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:

  -h, --help            show this help message and exit
  -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 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)
  --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

update_mypy_hook-0.2.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

update_mypy_hook-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file update_mypy_hook-0.2.0.tar.gz.

File metadata

  • Download URL: update_mypy_hook-0.2.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.8

File hashes

Hashes for update_mypy_hook-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bb3e1d2c1218d4712520b044a9f1b0f10775b96fa686d4c1717acef37ae800ea
MD5 0c5141c022ed25b97c5f2481dc1c7919
BLAKE2b-256 1a65bdc4e9c5a0e0b9189358ef10b613bfbc18d7fe95396cc73264132a3b03d0

See more details on using hashes here.

File details

Details for the file update_mypy_hook-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for update_mypy_hook-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e49899069815b1134c10339202e956f182308f55a71928c2e99f313f73b5fb0a
MD5 3a5370f491b5713e052356bf44c90b95
BLAKE2b-256 25a645b50286ae7bc0adde36d7f20abd998308363e12981f8c0d3696094d21c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page