{"id":21346,"library":"flake8-pep3101","title":"flake8-pep3101","description":"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.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/gforcada/flake8-pep3101","tags":["flake8","plugin","linting","pep3101","string-formatting","old-style"],"install":[{"cmd":"pip install flake8-pep3101","lang":"bash","label":"Install"}],"dependencies":[],"imports":[{"note":"Imported as a flake8 plugin, not directly called. Flake8 auto-discovers.","wrong":"","symbol":"flake8_pep3101","correct":"import flake8_pep3101"}],"quickstart":{"code":"# Create a file with old-style formatting\ncode = \"name = 'world'; print('Hello %s' % name)\"\nwith open('test.py', 'w') as f:\n    f.write(code)\n\n# Run flake8\nimport subprocess\nresult = subprocess.run(['flake8', 'test.py'], capture_output=True, text=True)\nprint(result.stdout)\n# Expected: test.py:1:1: P101 % string formatting","lang":"python","description":"Create a sample Python file with old-style % formatting and run flake8 to see the P101 warning."},"warnings":[{"fix":"Use str.format() or f-strings as per PEP 3101.","message":"The plugin only detects '%' formatting, not 'Template' strings or other patterns.","severity":"gotcha","affected_versions":"all"},{"fix":"Review warnings manually or use # noqa: P101 to suppress if legitimate.","message":"The plugin may produce false positives when '%' is used in non-string contexts (e.g., modulo operator) or inside comments.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to 3.0.0. No code changes needed.","message":"Old versions used import from flake8_pep3101; plugin auto-loads via flake8's built-in plugin discovery.","severity":"deprecated","affected_versions":"<3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install flake8-pep3101' and ensure flake8 is installed in the same environment.","cause":"Plugin not installed or not recognized by flake8.","error":"flake8: P101 not found"},{"fix":"Do not import manually; just install the package and run 'flake8'.","cause":"Trying to import the plugin directly in code instead of using it as a flake8 plugin.","error":"ModuleNotFoundError: No module named 'flake8_pep3101'"},{"fix":"Use '%%' for literal percent or use # noqa: P101.","cause":"Plugin might flag '%' in strings that are not Python formatting but intended as literal percent (e.g., SQL queries, URLs).","error":"P101 warning for modulo in bash-like string"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}