Registry / testing / flake8-pep3101

flake8-pep3101

JSON →
library3.0.0pypypi✓ verified 86d ago

A flake8 plugin that checks for use of old-style % string formatting, enforcing PEP 3101 (str.format and f-strings). Current version 3.0.0, supports Python >=3.10. Maintained on GitHub.

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

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

flake8_pep3101
import flake8_pep3101
Imported as a flake8 plugin, not directly called. Flake8 auto-discovers.

Create a sample Python file with old-style % formatting and run flake8 to see the P101 warning.

# Create a file with old-style formatting code = "name = 'world'; print('Hello %s' % name)" with open('test.py', 'w') as f: f.write(code) # Run flake8 import subprocess result = subprocess.run(['flake8', 'test.py'], capture_output=True, text=True) print(result.stdout) # Expected: test.py:1:1: P101 % string formatting
Debug
Known issues
gotchaThe plugin only detects '%' formatting, not 'Template' strings or other patterns.
fix
Use str.format() or f-strings as per PEP 3101.
affects: all
gotchaThe plugin may produce false positives when '%' is used in non-string contexts (e.g., modulo operator) or inside comments.
fix
Review warnings manually or use # noqa: P101 to suppress if legitimate.
affects: all
deprecatedOld versions used import from flake8_pep3101; plugin auto-loads via flake8's built-in plugin discovery.
fix
Upgrade to 3.0.0. No code changes needed.
affects: <3.0.0
Errors
Common errors & fixes
flake8: P101 not found
Plugin not installed or not recognized by flake8.
fix
Run 'pip install flake8-pep3101' and ensure flake8 is installed in the same environment.
ModuleNotFoundError: No module named 'flake8_pep3101'
Trying to import the plugin directly in code instead of using it as a flake8 plugin.
fix
Do not import manually; just install the package and run 'flake8'.
P101 warning for modulo in bash-like string
Plugin might flag '%' in strings that are not Python formatting but intended as literal percent (e.g., SQL queries, URLs).
fix
Use '%%' for literal percent or use # noqa: P101.
Upgrade
Version history
3.0.0latest on PyPI · released Oct 25, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
flake8-pep3101 — pip install flake8-pep3101 · libregistry