Skip to main content

Flake8 plugin for enforcing type annotations.

Project description

Flake8 Typing Annotations Enforcement Plugin

Overview

This Flake8 plugin is designed to enforce the usage of typing annotations in your Python code. By integrating this plugin into your Flake8 workflow, you can ensure that your codebase adheres to a consistent and explicit typing style, promoting better code readability and maintainability.

Features

  • Type Annotation Enforcement: The plugin checks your Python code for functions, variables, and parameters that lack type annotations and raises warnings or errors accordingly.

  • Selective Ignoring: Use inline comments to selectively ignore the type annotation checks for specific lines or blocks of code.

Installation

You can install this Flake8 plugin using pip:

pip install flake8-enforce-type-annotations

Usage

After installation, the plugin becomes available as part of your Flake8 toolchain. Simply run Flake8 on your project to enforce typing annotations:

flake8 your_project_directory

Configuration

You can configure the strictness of the enforcement by adjusting the plugin settings in your Flake8 configuration file (usually .flake8):

per-file-ignores = 
    utils.py:ETA002,ETA001

Inline Ignoring

If you need to bypass the type annotation checks for specific lines or blocks of code, you can use inline comments:

def unannotated_function():
    # ... code without type annotations

Contributing

Contributions to this Flake8 plugin are welcome! If you encounter issues or have ideas for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This Flake8 plugin is distributed under 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

flake8-enforce-type-annotations-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8-enforce-type-annotations-0.1.1.tar.gz.

File metadata

File hashes

Hashes for flake8-enforce-type-annotations-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e36627a7b1abb5bfc3db5fddb7c2f0a4b1ac406005984ed05c386bbeaab51284
MD5 55996ed3ade9d966b3b09431e74a0f99
BLAKE2b-256 022c5f6999d1ba254c50ae315a2969d838ab69e137c8b3a9745ddacc0f9e4dcf

See more details on using hashes here.

File details

Details for the file flake8_enforce_type_annotations-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_enforce_type_annotations-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56f9b43c9c11eef0b019f997565d7c13b81644b678f9d246cbd7550a9268b321
MD5 49c92d09c31bce0ed79c331fc3c9ef7b
BLAKE2b-256 12d3800d1426afb7f3e853ed8c189ca08efe2b48d3704dad62eb09684a713969

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