Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with prompt_toolkit v3.0.0 #11975

Closed
jakul opened this issue Nov 28, 2019 · 4 comments · Fixed by #11979
Closed

Incompatibility with prompt_toolkit v3.0.0 #11975

jakul opened this issue Nov 28, 2019 · 4 comments · Fixed by #11979
Milestone

Comments

@jakul
Copy link

jakul commented Nov 28, 2019

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'

PromptSession in prompt_toolkit v3 does not have an inputhook parameter - https://github.com/prompt-toolkit/python-prompt-toolkit/blob/4cbbf8b9db1cb11caa1d72f4200c5cbc48bfd384/prompt_toolkit/shortcuts/prompt.py#L340-L383

@iuliachiriac
Copy link

There's also a discussion (and some solutions) on this issue here: #11962

@Carreau
Copy link
Member

Carreau commented Nov 30, 2019

See #11979. I'll try to do a 7.10.1 on monday.

@techtonik
Copy link
Contributor

@Carreau but 7.10 is not out, why 7.10.1?

@techtonik
Copy link
Contributor

Nevermind. It is on PyPI already https://pypi.org/project/ipython/7.10.0/#files

@Carreau Carreau modified the milestones: 7.10, 7.10.1 Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants