When developing a Python package, it\'s very convenient to use the -m option to run modules inside the package as scripts for quick testing. For example, for
-m
After experimenting with this for quite some time, it turns out that this approach actually works:
python -c "import runpy; import pdb; pdb.runcall(runpy.run_module, 'somepackage.somemodule', run_name='__main__')"
For some reason, the use of pdb.runcall over pdb.run is important.
pdb.runcall
pdb.run