Home

Awesome

flake8-warnings

Python linter that warns you about using deprecated modules, classes, and functions. It provides a CLI as well as flake8 and pylint plugins.

Usage

Installation:

python3 -m pip install flake8-warnings

Now, you can use it in one of the following ways:

  1. Directly from CLI: python3 -m flake8_warnings ./my_project/
  2. As a flake8 plugin. Just run flake8 ./my_project/, it will automatically detect the plugin.
  3. As a pylint plugin. For pylint, plugins must be explicitly specified: pylint --load-plugins=flake8_warnings ./my_project/.

How it works

It analyzes all imported modules, classes and functions and detects the following:

  1. warnings.warn function calls.
  2. Deprecation decorators like deprecated or deprecation.
  3. Deprecation messages in docstrings.
  4. Stdlib modules deprecated by PEP 594.

Error codes

The tool provides a different error code for each warning category:

This is how they are used in different linters:

In all cases, the error message is the detected warning message.

License

  1. flake8-wranings is licensed under MIT License. On practice, I don't care how you're going to use it. i did the project because it is fun, not because I want to be famous or whatever.
  2. astroid is a direct runtime dependency of flake8-warning and it is licensed under LGPL-2.1 License. It allows commercial and private usage, distribution and whatever, don't confuse it with GPL. However, if your legal department is still nervous, just don't make flake8-warnings a production dependency (why would you?), use it only on dev and test environments.