httpie / http-prompt

An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie

Home Page:https://http-prompt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any chance to port to prompt_toolkit 3?

Flexximilian opened this issue · comments

Hi!

I just learned about this little gem today and ended up trying to write a Gentoo Ebuild for http-prompt, but one thing missing from the official Gentoo tree is a prompt_toolkit < 2.0.0... Is there a chance to support prompt_toolkit 2 or 3, or are there tons of work to migrate? (Hmm... The "Why all the breaking changes?" header on their migration page isn't a good sign I guess... ;) )

AFAIK, Gentoo is trying to move on from Python <3.6 (or <2.7), so overlaying a prompt_toolkit version < 2.0.0 isn't really a good option...

But since I'm not at all a Python coder, I am a bit wary of even trying myself to be honest.

commented

I'd like to add a +1 to this request, as I ran into exactly this issue when trying to package http-prompt for Fedora, where we have prompt_toolkit version 3.

Sorry if I'm misreading something, but I think that commit bumps to prompt-toolkit v2 but this issue is about prompt-toolkit v3?

Yeah, +1 – I can't use http-prompt on my laptop anymore, because the system version of prompt_toolkit is v3, and http-prompt doesn't work with that one:

ImportError: cannot import name 'AbortAction' from 'prompt_toolkit' (/usr/lib/python3.9/site-packages/prompt_toolkit/__init__.py)

In the meantime, it would be nice to have an easy way to start http-prompt via Python, like python -m http_prompt or python -m http_prompt.cli, because that makes running http-prompt from a virtualenv much easier. If you want to do this, find your cli.py file and add two lines at the bottom:

if __name__ == "__main__":
    cli()
commented

bump

I didn't install in the system level, rather through pyenv, and I usually install ipython as part of adding a python version, but ipython and http-prompt can't be in the same venv or pyenv because of this dependency clash

So updating to v3 would really help

But since http-prompt does not involve python coding, I opted for using it as a tool and not another python package, so installing with pipx did the trick:

pip uninstall -y http-prompt
pip install -U pipx
pipx install http-prompt