Problem
pdb.Pdb accepts a skip parameter containing glob-style module-name patterns:
pdb.Pdb(skip=["django.*", "some_package.generated.*"])
However, this existing functionality cannot be configured when invoking pdb through its command-line interface:
python -m pdb -m some_package.module
It also cannot be configured cleanly from .pdbrc. Commands from .pdbrc execute in the context of the debugged frame, and there is no documented reference to the active pdb.Pdb instance.
The current workaround requires accessing pdb implementation details:
!import sys; _pdb = sys._getframe(1).f_locals["self"]; _pdb.skip = {"some_package.*"}
This depends on the internal call stack and the local variable name used by pdb, so it is unsuitable as a supported configuration mechanism.
Proposed behavior
Expose Pdb(skip=...) through both the command-line interface and pdb commands.
For example, allow a repeatable --skip option:
python -m pdb \
--skip "django.*" \
--skip "some_package.generated.*" \
-m some_package.module
The collected patterns would be passed to the existing Pdb(skip=...) parameter.
Additionally, add a debugger command that can be used interactively, through -c, or from .pdbrc:
skip django.* some_package.generated.*
For example, .pdbrc could contain:
skip asyncio.*
skip concurrent.futures.*
Invoking the command without arguments could display the currently configured patterns:
(Pdb) skip
Skipped module patterns:
asyncio.*
concurrent.futures.*
There should also be a supported way to remove patterns, such as:
unskip asyncio.*
The exact command syntax is open to discussion. The important part is providing a supported route from the CLI and .pdbrc to the existing Pdb.skip functionality.
Standard-library convenience
A --skip-stdlib option and corresponding .pdbrc command would also be useful:
python -m pdb --skip-stdlib -m some_package.module
skip stdlib
On Python versions that provide sys.stdlib_module_names, this could be implemented using patterns for both the top-level modules and their submodules.
Standard-library skipping should remain opt-in because users may need to debug standard-library code, and an application module can shadow a standard-library module name.
Rationale
Module skipping is particularly useful when stepping through application code that calls into frameworks, generated modules, or the standard library. The underlying debugger has supported this since the addition of the skip parameter, but that capability is effectively unavailable to users of the standard python -m pdb workflow.
Exposing it would:
-
Make
Pdb(skip=...)usable from the normal pdb CLI. -
Allow project-specific skip configuration in
.pdbrc. -
Eliminate reliance on private frame and local-variable details.
-
Permit skip patterns to be inspected and changed during a debugging session.
-
Preserve the existing behavior by making all skipping opt-in.
Current workaround
For reference, the workaround currently required in .pdbrc is similar to:
!import sys; _pdb = sys._getframe(1).f_locals["self"]; _pdb.skip = (_pdb.skip or set()) | {"some_package.*"}; del _pdb
The need to reach into sys._getframe(1).f_locals to configure an already-supported Pdb option indicates that the command-line interface is missing an appropriate configuration mechanism.
Skipping stdlib through .pdbrc
!import sys; _pdb = sys.getframe(1).f_locals\["self"\]; _pdb.skip = (_pdb.skip or set()) | {"click.\*"} | {p for n in sys.stdlib_module_names for p in (n, n + ".*")}; del _pdb;
Why not use IPython’s debugger, an IDE, or another debugger?
Third-party debuggers and IDE integrations may provide similar stepping filters or more extensive configuration. However, they are not always available in the environments where pdb is most valuable.
My primary development environment is an air-gapped system. It currently uses Python 3.10 and is expected to move to Python 3.14, but upgrades are irregular and installing an additional debugger package is not always possible. Every additional dependency must be acquired, reviewed, approved, transferred, and maintained within the isolated environment.
I also frequently work through SSH, including on remote systems where a graphical IDE or its remote-debugging integration is unavailable or impractical. In these situations, the standard-library pdb CLI is the most portable and consistently available debugger:
python -m pdb -m package.module
This proposal does not attempt to reproduce the broader functionality of IPython, ipdb, IDE debuggers, or other third-party tools. It exposes functionality that pdb.Pdb already implements through the standard python -m pdb interface. Users should not need an additional package or graphical development environment merely to supply the existing skip= parameter.
Disclosure: I used an AI assistant to help draft and organize this feature proposal. I reviewed and edited the resulting text, and the proposal reflects the behavior and use case I encountered.