Registry / testing / flake8-print

flake8-print

JSON →
library5.0.0pypypi✓ verified 25d ago

Flake8 print plugin. This module provides a plugin for flake8, the Python code checker, specifically designed to identify and flag the use of `print` statements in Python files. The current version is 5.0.0, and it has a moderate release cadence with several updates per year, including major versions for significant changes.

pip install flake8-print
INSTALL
IMPORT
SIG · FLAKE8-PRINT
F
flake8-print
testingpythonv5.0.0
Install
1.8s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.0.0 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

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

Usage as a plugin
No direct import is needed; flake8 automatically discovers installed plugins via entry points.
Flake8 plugins are automatically loaded by the flake8 command-line tool once installed, so no explicit Python import statement is typically used in user code.

After installing `flake8` and `flake8-print`, save the code above to a file (e.g., `example.py`). Run `flake8 example.py` from your terminal. Flake8 will report T201 errors for the detected `print` statements. The second `print` statement includes a `# noqa: T201` comment to explicitly ignore the `flake8-print` warning on that line.

print('This line will be flagged by flake8-print') # To demonstrate ignoring a specific print statement: import os if os.environ.get('DEBUG_MODE', 'False') == 'True': print('Debug message') # noqa: T201
flake8 --version
Debug
Known issues
breakingPython 2.7 support was officially dropped in version 4.0.0. Ensure your project runs on Python 3.7+ before upgrading to or using 4.0.0 and above.
fix
Migrate your codebase to Python 3.7 or newer. If you need Python 2.7 support, you must use an older version of flake8-print (e.g., <4.0.0).
affects: >=4.0.0
breakingIn version 5.0.0, the error code namespace was moved from `T0xx` to `T2xx` (e.g., `T001` became `T201`). Projects relying on specific `ignore` lists or `noqa` comments for `T0xx` codes will need to update them to the new `T2xx` prefix.
fix
Update any `noqa: T0xx` comments or `flake8` configuration `ignore` lists to use `T2xx` (e.g., `noqa: T201`).
affects: 5.0.0
breakingVersion 3.0.0 introduced a loss of multiline `noqa` support when the checker moved from a logical line checker with regex to an AST-based approach. While `2.0.0` supported `noqa` on multiline `print` statements, this was temporarily lost in `3.0.0` and `4.0.1` had a fix related to `noqa` detection.
fix
For versions where multiline `noqa` is not fully supported, refactor multiline print statements or use `noqa` on each relevant line if supported for single-line usage. Ensure you are on `4.0.1` or newer for improved `noqa` detection.
affects: >=3.0.0, <4.0.1 (partially)
gotchaIncorrect or incomplete `noqa` comments. To ignore specific `flake8-print` errors, use `# noqa: T201` (for `print` statements) or `# noqa: T203` (for `pprint` statements) at the end of the line. Using just `# noqa` will ignore all `flake8` warnings on that line. Make sure to use the correct `T2xx` error codes from version 5.0.0 onwards.
fix
Consult `flake8` documentation and `flake8-print` error codes for precise `noqa` usage. Use `# noqa: T201` for a `print` statement, `# noqa: T203` for a `pprint` statement.
affects: All versions, especially >=5.0.0 for new error codes
Upgrade
Version history
5.0.0latest on PyPI · released Apr 30, 2022
Audit
Dependencies
flake8requiredThis is a plugin for flake8, requiring flake8 itself to be installed for functionality.
Agent activity
7 hits · last 30 days
node
6
Resources
flake8-print — pip install flake8-print · libregistry