pudb icon indicating copy to clipboard operation
pudb copied to clipboard

PEP 553

Open asmeurer opened this issue 6 years ago • 9 comments

This was accepted. It adds a breakpoint() builtin, and a sys.breakpointhook and PYTHONBREAKPOINT environment variable to configure it. Obviously we should add support for it.

asmeurer avatar Oct 03 '17 03:10 asmeurer

Python 3.7 was released with this included so it can now be tested and used.

drrlvn avatar Aug 13 '18 13:08 drrlvn

I guess all the standard pudb entry points should set sys.breakpointhook on 3.7+. We can also add some docs on how to set PYTHONBREAKPOINT so that you can just use breakpoint() without importing pudb.

asmeurer avatar Aug 13 '18 18:08 asmeurer

Yeah. I'd say we also set sys.breakpointhook = pudb.set_trace when pudb is imported.

Any volunteers to hack together the patch?

inducer avatar Aug 13 '18 19:08 inducer

I'm not a fan of imports without any function calls changing behavior like that (magic imports like pudb.b notwithstanding). Though I don't know if anyone ever imports pudb as a library.

asmeurer avatar Aug 13 '18 19:08 asmeurer

I agree with the sentiment. In this case, my thought was to make python -m pudb do the obviously (I guess?) correct thing when it hits breakpoint(). It seems we only get to have one of these, and I'm leaning towards sacrificing freedom from side effects on import. You?

inducer avatar Aug 13 '18 19:08 inducer

You can still enable it on all the entrypoints. python -m pudb runs main(), which isn't run with just import pudb https://github.com/inducer/pudb/blob/master/pudb/main.py#L31

asmeurer avatar Aug 13 '18 19:08 asmeurer

Fair. Just doing it in main() would be sufficient IMO then.

inducer avatar Aug 13 '18 19:08 inducer

Thanks for your work on this project - it has been my favorite debugger for years.

As it is now, it doesn't seem like there's a way to set parameters - in a remote debugging case for example

from pudb.remote import set_trace; set_trace(term_size=(80, 24)) 

trying to set PYTHONBREAKPOINT=pudb.remote.set_trace works sometimes, but in docker for example the default settings result in a blacked out screen

Is there a separate mechanism to set the parameters either with an intermediate class constructor or separate env variables, like https://pypi.org/project/remote-pdb/ ?

chrisamow avatar Oct 05 '20 22:10 chrisamow

in docker for example the default settings result in a blacked out screen

We should see about getting that fixed. Could you file a bug?

Is there a separate mechanism to set the parameters either with an intermediate class constructor or separate env variables, like https://pypi.org/project/remote-pdb/ ?

Not currently, but a PR could change that. :)

inducer avatar Oct 06 '20 03:10 inducer

Don't know if there's anything left to do here. breakpoint() and PYTHONPBREAKPOINT are documented, and setting sys.breakpoint automatically seemed like a bad idea.

asmeurer avatar Feb 09 '24 00:02 asmeurer