3 ms·
It's really a matter of culture. Things like httpie, jupyter, etc should be provided as pyz and binaries as well, not just pip installable, but python devs don
by BiteCode_dev 6y ago
It's really a matter of culture.
Things like httpie, jupyter, etc should be provided as pyz and binaries as well, not just pip installable, but python devs don't do that really often.
It's a shame, because cli tools should be black boxes, people should not have to think about the implementation. I regularly see cli python tools that output stack traces on errors, and it should not happen.
Anyway, if you want those tools to be always around, I really encourage you to grap a usb stick, and put them on there as pyz and binaries. It's always nice to have them at hand.
Here is an example procedure for both (run them in a venv).
For pyz files:
python -m pip install shiv --user # (Yes, I realize how ironic this is).
Then:
python -m shiv httpie -o http.pyz -c http
(download httpie, and creates a http.pyz file that will contains httpie and all it's dependancies, plus code to trigger the http command when called)
This will let you do "python http.pyz" anywhere you have a modern python and enjoy httpie without the need to pip install it.
For an exe (this is an example on linux, the commands are a bit different for windows and mac):
python -m pip install nuitka httpie --user
You need to have a C compiler and python headers around as well (gcc on linux will do, E.G: sudo apt install build-essential python3-dev on ubuntu).
Then:
python -m nuitka $(which http) --onefile --linux-onefile-icon /usr/share/pixmaps/python3.xpm --follow-imports --assume-yes-for-downloads
Wait quite a bit.
Now you have a nice stand alone AppImage you can call with ./http.bin to be used on any linux system, and not care if Python is installed to play with httpie.
Here are the resulting files (available for 5 days) so you can see what it looks like:
https://drop.chapril.org/download/a335a8e92f98ee02/#fHC1SvOwXrhIzTT93_Jtig https://drop.chapril.org/download/a335a8e92f98ee02/#fHC1SvOw...
- CameronNemo 6y agoIs this better than using pex?
- BiteCode_dev 6y agoPyz works with windows but not pex. Nuitka produces a standalone exe so no need to install python.