gotcha / ipdb

Integration of IPython pdb
BSD 3-Clause "New" or "Revised" License
1.85k stars 146 forks source link

Incompatibility with prompt_toolkit v3 #175

Closed jakul closed 4 years ago

jakul commented 4 years ago

I noticed the following error today:

    def pt_init(self):
        def get_prompt_tokens():
            return [(Token.Prompt, self.prompt)]

        if self._ptcomp is None:
            compl = IPCompleter(shell=self.shell,
                                        namespace={},
                                        global_namespace={},
                                        parent=self.shell,
                                       )
            self._ptcomp = IPythonPTCompleter(compl)

        kb = KeyBindings()
        supports_suspend = Condition(lambda: hasattr(signal, 'SIGTSTP'))
        kb.add('c-z', filter=supports_suspend)(suspend_to_bg)

        if self.shell.display_completions == 'readlinelike':
            kb.add('tab', filter=(has_focus(DEFAULT_BUFFER)
                                  & ~has_selection
                                  & vi_insert_mode | emacs_insert_mode
                                  & ~cursor_in_leading_ws
                              ))(display_completions_like_readline)

        self.pt_app = PromptSession(
                            message=(lambda: PygmentsTokens(get_prompt_tokens())),
                            editing_mode=getattr(EditingMode, self.shell.editing_mode.upper()),
                            key_bindings=kb,
                            history=self.shell.debugger_history,
                            completer=self._ptcomp,
                            enable_history_search=True,
                            mouse_support=self.shell.mouse_support,
                            complete_style=self.shell.pt_complete_style,
                            style=self.shell.style,
                            inputhook=self.shell.inputhook,
>                           color_depth=self.shell.color_depth,
        )
E       TypeError: __init__() got an unexpected keyword argument 'inputhook'

This is because ipdb is not compatible with prompt_toolkit v3.0.0 (released 24th Nov) .

Can you either make ipdb compatible, or specify an upper bound for prompt_toolkit in the ipdb requirements please?

gotcha commented 4 years ago

AFAICS, this is an IPython issue. Reminder: ipdb is a lightweight wrapper of IPython

If I understand well what I see on https://github.com/ipython/ipython/releases, there is an upcoming 7.10.0 release coming that should fix your issue.

Do not hesitate to reopen if I am wrong.

jakul commented 4 years ago

Yeah, I'd just figured out the same myself! Thanks, and sorry for wasting your time.

gotcha commented 4 years ago

As I sometimes merge code done by others I do not always remember it all, this gave me a chance to remember that prompt_toolkit is an IPython dependency :wink:

jakul commented 4 years ago

The error is present even with IPython 7.10.0, so I've opened a new issue for them - https://github.com/ipython/ipython/issues/11975

hachreak commented 4 years ago

With prompt_toolkit==2.0.10 looks working again! :smile: