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.

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: 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:

  -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)

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.3.0.tar.gz (56.8 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.3.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for update_mypy_hook-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e69ff6b6e8bc3376dd400fccfebc5c6d2fcfb2bb3edb0203093bd608db534985
MD5 9c71e7c2be9dc445a4ce6d6c2cabcc9b
BLAKE2b-256 9b5e6e2d0665efe7118e1300fd916f29d17008fe3ae459f9dc8eccf27590247d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for update_mypy_hook-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3842b2c996f4fc1651b4b9b34c1ca374a2ac4673db9f26a9e5fdc2b24f64a806
MD5 ce876a29ff3640a85df810d22ddf8aa5
BLAKE2b-256 4da2683001eb0a000258272857923a32c6e7c2d5c283ac14fc2e43b200e8e8d4

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