Skip to main content

Progressive type annotation without regression! 🚀

Project description

promypy

Latest Commit
Package version

You've decided to add type annotation on the code source. What's your plan? 😅

This package is a small tool set to help you to achieve your dreamed fully type annotation project. 🚀

Using mypy, you'd probably add a files entry on your configuration file, and each time someone on the team wants to include type annotation on that file, you'd add on the files list. There are a some problems with this approach:

  1. Each new file is not added to the files list.
  2. If a file gets fully type annotated, you don't notice, and it will not be added to the files list.

The 1. is more important, as we don't want to have regressions on our goal to have our code source fully type annotated. But you don't want to worry about 2. as well...

What this package does:

  • dump: Generates a list of files that are currently not type annotated.
  • check: Given an input of files:
    • If a file is in the list, and is fully type annotated, it will be removed from the list.
    • If a file is in the list, and is not fully annotated, it will be ignored.
    • If a file is not in the list, and is fully annotated, it will be ignored.
    • If a file is not in the list, and is not fully annotated, it will raise errors.

Installation

As usual.

pip install promypy

Usage

There are two commands available: dump and check.

Dump

The idea of this command is to store the list of files that are not fully type annotated into a file.

Usage: promypy dump [OPTIONS] FILES...

  Generate a list of files that are not fully type annotated.

Arguments:
  FILES...  [required]

Options:
  --mypy-args TEXT
  --output TEXT
  --help            Show this message and exit.

Check

Usage: promypy check [OPTIONS] FILES...

  Check the given files with mypy, applying a set of custom rules.

Arguments:
  FILES...  [required]

Options:
  -f, --ignore-file PATH  [required]
  --mypy-args TEXT
  --help                  Show this message and exit.

Pre-commit

Add the following to your .pre-commit-config.yaml file:

  - repo: https://github.com/Kludex/promypy
    rev: 0.3.0
    hooks:
      - id: promypy
        args:
        - --ignore-file=<dump_filename>

License

This project is licensed under the terms of the MIT license.

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

promypy-0.3.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

promypy-0.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: promypy-0.3.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for promypy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 77cc336bc8bba60357948a581d3b90ada487bef742e2d214c0a6d1646930a648
MD5 53a86e7747738b0ede5faf647b1e264c
BLAKE2b-256 ef70fdc1a02793d64f2a4813dbbfd9111e3b8b0c61b48e453050e43d6c24af1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: promypy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for promypy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 892891120bb613a3dc710a3a18150b73422b2bcea6546ab0aafe8a799c2cfecb
MD5 c03238d98cba3470c8171224ce214c43
BLAKE2b-256 eaf456feec2ae4abeef21923deba85997f3c8d22ea514040c20e2d009c046db2

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