deshaw / pyflyby

A set of productivity tools for Python
https://deshaw.github.io/pyflyby/
Other
358 stars 52 forks source link

Disable overriding the global breakpoint (PyInf#13454) #357

Closed dshivashankar1994 closed 2 months ago

dshivashankar1994 commented 2 months ago

when Ipython is configured to load pyflyby automatically, eg:

$ cat ~/.ipython/profile_default/ipython_config.py
...
c.InteractiveShellApp.extensions.append("pyflyby")

Then pyflyby overwrites the breakpoint() function:

% ipython
Python 3.11.8 (main, Mar 15 2024, 12:37:54) [GCC 10.3.1 20210422 (Red Hat 10.3.1-1)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.22.2+desco.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: breakpoint
Out[1]: <function pyflyby.debugger(*args, **kwargs)>

From the code, I see that this feature is deprecated:

    # DEPRECATED: In the future, the following will not be added to builtins.
    # Use debugger() instead.
    functions_to_add += [
        'breakpoint',
        'debug_exception',
        'debug_statement',
        'waitpoint',
    ]
    for name in functions_to_add:
        setattr(builtins, name, globals()[name])

Can we get this deprecation fulfilled or have some way to disable this ? Noting that this is a high priority ask from us (cc @quarl )

propertone commented 2 months ago

Note that this issue is specifically affecting the VSCode debugger as pyflyby is incorrectly intercepting a breakpoint set by VSCode