{"id":6634,"library":"flake8-debugger","title":"flake8-debugger","description":"flake8-debugger is a plugin for the flake8 code quality tool that checks for the presence of common debugger statements (like `pdb.set_trace()`, `ipdb.set_trace()`, and `breakpoint()`) in Python code. This helps prevent accidental commits of debugging code into production. The current version is 4.1.2. Releases are made periodically, typically following updates to Python versions or the flake8 ecosystem.","status":"active","version":"4.1.2","language":"python","source_language":"en","source_url":"https://github.com/jbkahn/flake8-debugger","tags":["flake8","linter","code quality","debugger","static analysis"],"install":[{"cmd":"pip install flake8-debugger","lang":"bash","label":"Install flake8-debugger"}],"dependencies":[{"reason":"This is a plugin for flake8 and requires flake8 to be installed to function. While not an explicit install_requires dependency, it's a functional requirement.","package":"flake8","optional":false}],"imports":[],"quickstart":{"code":"import os\n\ndef my_function():\n    # This line will be flagged by flake8-debugger\n    if os.environ.get('DEBUG_ENABLED', 'false').lower() == 'true':\n        import pdb; pdb.set_trace()\n    print(\"Hello, world!\")\n\nmy_function()\n\n# To run this example:\n# 1. Save the code as example.py\n# 2. Run 'pip install flake8 flake8-debugger'\n# 3. Run 'flake8 example.py' in your terminal\n# Expected output will include an error like 'example.py:6:9: D001 debugger detected'","lang":"python","description":"Install flake8-debugger alongside flake8. It automatically integrates. Create a Python file with a debugger statement and run flake8 on it to see the plugin in action."},"warnings":[{"fix":"Ensure your project uses Python 3.7 or newer. Upgrade your Python environment if necessary.","message":"Support for Python 3.6 was dropped in version 4.1.0.","severity":"breaking","affected_versions":">=4.1.0"},{"fix":"Migrate your project to Python 3.x. Version 3.1.0 was the last to explicitly support Python 2.7.","message":"Official support for Python 2.7 was dropped in version 4.0.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"No fix needed, this is intended behavior. Just ensure `flake8` is installed and run it as usual.","message":"flake8-debugger works as a plugin and does not require any explicit imports or configuration files to enable. Simply installing it makes it active when you run the `flake8` command.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For critical applications, supplement static analysis with runtime checks or enforce strict code review policies against debugging statements.","message":"While comprehensive, flake8-debugger relies on AST parsing and might not catch highly obfuscated or dynamic debugger calls. It primarily targets common patterns like `pdb.set_trace()` or `breakpoint()`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'4.1.2':49 'accident':38 'analysi':70 'breakpoint':31 'check':17 'code':13,34,42,66 'commit':39 'common':22 'current':46 'debug':41 'debugg':3,6,23,68 'ecosystem':63 'flake8':2,5,12,62,64 'flake8-debugger':1,4 'follow':55 'help':36 'ipdb.set':28 'like':25 'linter':65 'made':52 'pdb.set':26 'period':53 'plugin':9 'presenc':20 'prevent':37 'product':44 'python':33,58 'qualiti':14,67 'releas':50 'statement':24 'static':69 'tool':15 'trace':27,29 'typic':54 'updat':56 'version':47,59","created_at":"2026-04-15T18:36:20.096646+00:00","updated_at":"2026-04-16T15:03:40.527688+00:00","problems":[{"fix":"Ensure flake8-debugger is installed and up-to-date in your Python environment (`pip install --upgrade flake8-debugger`). Verify that flake8 recognizes the plugin by running `flake8 --version` and checking for 'flake8-debugger' in the output. Also, ensure the Python version running flake8 is compatible with the installed flake8-debugger version (e.g., Python 3.7+ for recent versions).","cause":"The flake8-debugger plugin is either not installed in the same environment as flake8, not recognized by flake8, or an older version is being used that doesn't correctly detect the debugger statements.","error":"flake8 does not report F999 (or any warnings) for pdb.set_trace() / breakpoint()"},{"fix":"Ensure that flake8 is installed and run with the same Python version that your code is written for. It is recommended to use a virtual environment, activate it, and install flake8 and flake8-debugger within that environment.","cause":"This error occurs when flake8 (and its plugins, including flake8-debugger) attempts to parse Python code using a Python interpreter version that is incompatible with the syntax in the code (e.g., linting Python 3 code with a flake8 installed in a Python 2 environment, or vice-versa).","error":"E999 SyntaxError: invalid syntax"},{"fix":"To ignore F999: For a single line, add `# noqa: F999` at the end of the line. For an entire file, add `# flake8: noqa` at the top of the file, or use the `--per-file-ignores` option in your configuration (e.g., `per-file-ignores = path/to/file.py:F999`). To ignore globally, add `ignore = F999` to the `[flake8]` section in your `setup.cfg`, `tox.ini`, or `.flake8` configuration file, or use `flake8 --ignore F999` on the command line.","cause":"The flake8-debugger plugin is correctly identifying debugger statements, and the user needs to configure flake8 to ignore these specific warnings.","error":"F999 (or any flake8-debugger specific codes) reported, but I want to ignore them."},{"fix":"First, confirm `flake8-debugger` is installed and recognized (`pip install --upgrade flake8-debugger` then `flake8 --version`). Ensure your flake8 configuration (e.g., `setup.cfg`, `pyproject.toml`, `.flake8`) does not accidentally exclude the F999 code or the files where you expect the checks to run. Review the `exclude` and `ignore` settings in your flake8 configuration.","cause":"While not a direct error message, this is a common problem where the plugin is installed but its checks are not being applied. This can be due to flake8 not properly loading the plugin or configuration issues.","error":"flake8-debugger is installed but doesn't seem to be running or checking anything."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jbkahn/flake8-debugger","docs":null,"changelog":null,"pypi":"https://pypi.org/project/flake8-debugger/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-15","next_check":"2026-07-14","install_tag":null}}