{"library":"ipdb","title":"ipdb: IPython-enabled pdb","description":"ipdb is an interactive debugger for Python that extends the functionality of the built-in `pdb` debugger. It integrates features from IPython, such as syntax highlighting, tab completion, better tracebacks, and an enhanced command set, making debugging more interactive and user-friendly. Currently at version 0.13.13, it maintains an active development pace with releases addressing compatibility and new features.","status":"active","version":"0.13.13","language":"en","source_language":"en","source_url":"https://github.com/gotcha/ipdb","tags":["debugger","ipython","pdb","development","debugging"],"install":[{"cmd":"pip install ipdb","lang":"bash","label":"Install ipdb"}],"dependencies":[{"reason":"Core dependency for enhanced debugging features. Specific versions are required depending on your Python version.","package":"ipython","optional":false},{"reason":"Runtime dependency for functionality.","package":"decorator","optional":false},{"reason":"Runtime dependency, typically for older Python versions that don't have it built-in.","package":"pathlib","optional":true},{"reason":"Used for reading configuration files (e.g., pyproject.toml).","package":"toml","optional":false},{"reason":"Used for reading TOML configuration files, especially for Python versions 3.6-3.10.","package":"tomli","optional":false}],"imports":[{"note":"The most common way to set a breakpoint in your code.","symbol":"set_trace","correct":"import ipdb; ipdb.set_trace()"},{"note":"Initiates post-mortem debugging after an uncaught exception, similar to IPython's %debug magic.","symbol":"pm","correct":"import ipdb; ipdb.pm()"},{"note":"Context manager to automatically launch ipdb if an exception is raised within the 'with' block.","symbol":"launch_ipdb_on_exception","correct":"from ipdb import launch_ipdb_on_exception"},{"note":"Decorator to launch ipdb if an exception is raised in the decorated function.","symbol":"iex","correct":"from ipdb import iex"}],"quickstart":{"code":"import ipdb\n\ndef divide(a, b):\n    try:\n        # Set a breakpoint to inspect variables before the division\n        ipdb.set_trace()\n        result = a / b\n        return result\n    except ZeroDivisionError:\n        print(\"Cannot divide by zero!\")\n        return None\n\nprint(divide(10, 2))\n# To trigger the debugger on error, uncomment the line below and remove the try-except:\n# divide(10, 0)\n","lang":"python","description":"To use `ipdb.set_trace()`, simply place it where you want to pause execution. Run your script, and it will drop you into an interactive debugging session at that point. You can then inspect variables, step through code, and execute commands. Alternatively, run your script directly with `python -m ipdb your_script.py` to start debugging from the beginning or upon an exception."},"warnings":[{"fix":"Check `ipdb`'s `HISTORY.txt` or PyPI `Requires-Python` and `Requires-Dist` for exact `IPython` version constraints for your Python environment and `pip install 'ipython<X.Y'` or `'ipython>=X.Y'` accordingly.","message":"Critical IPython dependency versioning: `ipdb` relies heavily on `IPython`. Ensure correct `IPython` versions are installed for your Python version to avoid conflicts or missing features. For Python 3.6, install `7.16.3 <= IPython < 7.17.0`. For Python > 3.6, install `IPython >= 7.31.1`. Consult `ipdb`'s `HISTORY.txt` for detailed historical requirements if using older Python versions.","severity":"breaking","affected_versions":"All versions, specific to Python interpreter version"},{"fix":"Remove `ipdb.set_trace()` before deploying code to production. Consider using environment variables or conditional logic to enable debuggers only in development environments.","message":"Do not leave `ipdb.set_trace()` calls in production code. These breakpoints will halt program execution and expose the interactive debugger, which is a security risk and an operational blocker.","severity":"gotcha","affected_versions":"All versions"},{"fix":"No official fix yet; a reported workaround involves a minor change to `debugger.py` to canonicalize filenames. Consider using `pdb` or external IDE debuggers for complex Windows/Jupyter setups if this issue persists.","message":"In Jupyter Notebooks on Windows, `ipdb` may occasionally fail to display the current line and context (e.g., with the 'l' command) due to inconsistent directory separator handling (mixed slashes).","severity":"gotcha","affected_versions":"0.13.9 and possibly others (observed in February 2022)"},{"fix":"Upgrade to the latest `ipdb` version compatible with your Python interpreter, or ensure your Python version meets `ipdb`'s `requires_python` specification.","message":"Older `ipdb` versions dropped support for various Python versions. `ipdb` version 0.6 dropped Python 2.4 support, version 0.8 dropped Python 2.5 support, and version 0.10.3 dropped Python 3.2 support. Current versions require Python >= 2.7, excluding 3.0-3.3.","severity":"deprecated","affected_versions":"< 0.13.13"},{"fix":"Update `ipdb` to the latest version. If issues persist, consult the documentation of the conflicting tool or consider alternative debugging approaches for that specific environment.","message":"When using `ipdb` in environments that manipulate standard output (e.g., certain testing frameworks like older versions of `nose`), `ipdb`'s display might be affected. `ipdb` versions <= 0.9.4 had brittle strategies for handling such scenarios.","severity":"gotcha","affected_versions":"<= 0.9.4, but can affect newer versions with specific stdout-hooking tools"},{"fix":"Be aware that the IPython sub-shell might have a separate scope for certain operations. For direct manipulation of variables in the `ipdb` context, use `ipdb`'s native commands (e.g., `!variable = new_value`) or `p`rint to confirm state.","message":"Changes made to variables or objects within an IPython interactive shell launched from `ipdb` (e.g., using magic functions like `%ipdb`) might not always propagate back or affect the `ipdb` shell's context, leading to unexpected behavior if you expect state changes to persist across shells.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}