Skip to main content

A flake8 plugin to ban type hints.

Project description

https://img.shields.io/github/workflow/status/adamchainz/flake8-no-types/CI/main?style=for-the-badge https://img.shields.io/pypi/v/flake8-no-types.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

A flake8 plugin to ban type hints.

This can be useful in code bases where you aren’t running type checking (yet?) but developers or their IDE’s add type hints that can be incorrect.

Requirements

Python 3.6 to 3.10 supported.

Installation

First, install with pip:

python -m pip install flake8-no-types

Second, check that flake8 lists the plugin in its version line:

$ flake8 --version
3.7.9 (flake8-no-types: 1.0.0, mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.8.0 on Darwin

Third, add the NT prefix to your select list. For example, if you have your configuration in setup.cfg:

[flake8]
select = E,F,W,NT

Linting a Django project? Check out my book Speed Up Your Django Tests which covers loads of best practices so you can write faster, more accurate tests.


Rules

NT001: No type hints.

Flags all forms of type hints:

  • Function annotations: def foo() -> int:

  • Variable hints: foo: int = 1

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

flake8-no-types-1.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

flake8_no_types-1.2.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file flake8-no-types-1.2.0.tar.gz.

File metadata

  • Download URL: flake8-no-types-1.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for flake8-no-types-1.2.0.tar.gz
Algorithm Hash digest
SHA256 2b4a8cb9449faa40fdf17f76f1f0eacfa8adcf7269489fee0092d9287cf6d083
MD5 139d9050e4ba62ec650813daeb61c5fa
BLAKE2b-256 fd221a0a9ddf213ef01cc585eb7feed504609149ef878b370256842a760f0e09

See more details on using hashes here.

File details

Details for the file flake8_no_types-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_no_types-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for flake8_no_types-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a12168d0fc55e94247f2aaa3ebb5dfc0e7b6496f8e02ada9898e7bed70e5e161
MD5 7d85382bb28fec3ff534596e9b9168e5
BLAKE2b-256 07e76b376124e9993480c385876cfd4d21b10c34fc1e1d956ee1257a86e5163e

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