Skip to main content

Helps you check type hints when you commit code.

Project description

check-type-hints

pypi

What can it do?

It is a simple pre-commit plug-in that helps you check type hints in committed python files. Currently, only python is supported

Main function

function 1: --filter

It can help you filter folders that you don't want to check, like tests, pytests...

function 2: --method

It helps you filter function and method names that you don't want to check, such as get, post, put, and delete in Django view

function 3: --ignore/--no-ignore

By default, the plug-in checks type-hints that are not filled in, breaking the commit code and telling you where there is a problem. If you don't want to interrupt the commit, you can enable --ignore, which will only prompt warnings

Example:

First:

pip install pre-commit pip install check-type-hints

then:

Add file .pre-commit-config.yaml to the project root directory. eg:

repos:
  - repo: local
    hooks:
      - id: typehint-check
        name: Typehint Check
        entry: check_type_hints check --no-ignore --filter tests  --filter pytests --method get --method post --method put --method patch --method delete
        language: system
        types: [ python ]
        stages: [ commit ]
        pass_filenames: false
        verbose: true

and then:

pre-commit install

and finally:

You can enjoy it!

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

check-type-hints-0.0.4.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file check-type-hints-0.0.4.tar.gz.

File metadata

  • Download URL: check-type-hints-0.0.4.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0b4

File hashes

Hashes for check-type-hints-0.0.4.tar.gz
Algorithm Hash digest
SHA256 bbe338fe2d35b4567e94d5cab4ded738e61f133cbb1e31115831bab27d36161a
MD5 8150f41fa80b68a81dd33c6d47272e9d
BLAKE2b-256 e4bdf9d1b60005f9b0c341687de1e7d9a560998faa3fb4c19dec54da0dd29e5a

See more details on using hashes here.

Supported by

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