Registry / testing / pylint-flask

pylint-flask

JSON →
library0.6pypypiunverified

pylint-flask is a Pylint plugin designed to improve static code analysis for Flask applications. It helps Pylint correctly interpret Flask-specific patterns, particularly addressing issues related to the `flask.ext` import style (which has since been deprecated in Flask itself) and other dynamic attributes in Flask extensions. The current version is 0.6, released in January 2019, indicating a maintenance phase with infrequent updates.

pip install pylint-flask
INSTALL
IMPORT
SIG · PYLINT-FLASK
P
pylint-flask
testingpythonv0.6
Install
3.8s avg
Import
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 28.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.8s · import 0.000s · 29MB
27MB installed
● package 27MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pylint_flask
pylint --load-plugins pylint_flask your_module.py
from pylint_flask import ...
pylint-flask is loaded as a Pylint plugin via the command line, not imported directly into Python code.

Install `pylint-flask` and then run Pylint, explicitly loading the plugin with the `--load-plugins` flag. This example shows a minimal Flask app and how to lint it. For Flask extensions, ensure you are using direct imports (e.g., `from flask_wtf import ...`) as the `flask.ext` pattern is deprecated in modern Flask versions.

# my_flask_app.py from flask import Flask from flask_wtf import CSRFProtect # Example: direct import for Flask-WTF app = Flask(__name__) app.config['SECRET_KEY'] = 'a-very-secret-key' csrf = CSRFProtect(app) @app.route('/') def index(): return 'Hello, Flask!' # To run pylint with the plugin: # pylint --load-plugins pylint_flask my_flask_app.py
Debug
Known issues
breakingThe `flask.ext` import pattern, which `pylint-flask` was primarily designed to address, was officially deprecated and removed in Flask 2.0. If you are using Flask 2.0 or newer, you should be using direct imports for extensions (e.g., `from flask_wtf import ...`). `pylint-flask`'s core functionality for `flask.ext` may be less relevant or even cause unexpected linting behavior with modern Flask applications.
fix
For new projects or updated Flask versions (2.0+), migrate to direct imports for all Flask extensions (e.g., `from flask_sqlalchemy import SQLAlchemy` instead of `from flask.ext import sqlalchemy`). If you maintain older code, `pylint-flask` can still be beneficial, but be aware of the `flask.ext` deprecation.
affects: <= Flask 1.x (primary target of plugin), >= Flask 2.0 (impact on relevance)
gotchaWhile `pylint-flask` helps with generic Flask patterns, it may not fully resolve `E1101: no-member` errors for specific Flask extensions like Flask-SQLAlchemy or Flask-Migrate where attributes are dynamically added to objects. You might still encounter false positives for `db.Column`, `db.Integer`, etc.
fix
For Flask-SQLAlchemy specific `no-member` issues, consider using `pylint-flask-sqlalchemy` in addition to `pylint-flask`. Otherwise, you may need to disable specific `no-member` checks globally, locally, or add `--generated-members` to your Pylint configuration.
affects: All versions of pylint-flask and related Flask extensions
gotchaPylint might report `W0611: Unused import <module_name>` even when an import is indirectly used, for example, by a decorator or if `pylint-flask` transforms an import, but the original reference isn't explicitly used elsewhere in the file.
fix
If you are certain the import is necessary (e.g., for a decorator to register a route), you can explicitly tell Pylint to ignore the warning for that line using `# pylint: disable=unused-import` or configure Pylint to ignore this check for specific patterns.
affects: All versions
Upgrade
Version history
0.6latest on PyPI · released Jan 30, 2019
Audit
Dependencies
pylintrequiredpylint-flask is a plugin for Pylint and requires it to function.
Flaskrequiredpylint-flask is designed to analyze Flask applications.
Agent activity
10 hits · last 30 days
node
8
Resources
pylint-flask — pip install pylint-flask · libregistry