click-contrib / click-repl

Subcommand REPL for click apps
MIT License
215 stars 41 forks source link

History is not compatible with prompt_toolkit 2.0 #43

Closed theazureshadow closed 5 years ago

theazureshadow commented 6 years ago

Just a heads up: prompt_toolkit just released a 2.0 version. Not sure if it'll break anything else, but it broke history for us. It's possible this actually represents a bug in prompt_toolkit code rather than click-repl, but I haven't dug into it. The docs still imply that history should be a keyword argument.

We pinned our version to 1.x for now.

Here's the stack:

  File "/usr/local/lib/python2.7/site-packages/click_repl/__init__.py", line 192, in repl
    command = get_command()
  File "/usr/local/lib/python2.7/site-packages/click_repl/__init__.py", line 186, in get_command
    return prompt(**prompt_kwargs)
  File "/usr/local/lib/python2.7/site-packages/prompt_toolkit/shortcuts/prompt.py", line 793, in prompt
    return session.prompt(*a, **kw)
TypeError: prompt() got an unexpected keyword argument 'history'
theazureshadow commented 6 years ago

Opened an issue in prompt toolkit: https://github.com/jonathanslenders/python-prompt-toolkit/issues/632

theazureshadow commented 6 years ago

The prompt toolkit issue is fixed in master. Now for the prompt shortcut, they'll pop the history argument out of kwargs and pass it to PromptSession. It hasn't made it into a release yet.

untitaker commented 5 years ago

~Probably fixed by~ I fixed a bunch of prompt-toolkit related issues in https://github.com/click-contrib/click-repl/commit/62559405f01fb444819beccbb8cd5816b402e132, released in 0.1.5

theazureshadow commented 5 years ago

We unpinned the prompt toolkit version, and it still worked. I'm closing this issue.