Comments (27)
Hello @jakubroztocil,
As we discussed weeks ago, here is a PoC for a Windows installer attached and the procedure I used to generate it: https://drop.chapril.org/download/889aae1e4ee17fe9/#BBLdWchiazXCxNkma9lqQQ
The link will expire in 5 days, or 20 DL. I can't attach it on Github as it's bigger than 20Mo.
Dependencies
Generate the standalone executable
- Create a venv with a recent version of python and
pip install httpie nuitka
- Create a python module running the httpie cmd entry point. E.G:
from httpie.__main__ import main; main()
. Seerun_http.py
. - In the venv, ask nuikta to compile it:
nuitka run_http.py --standalone
.
In the last step, nuitka will prompt you for downloading dependencies (an import resolver and a compiler), say yes, and wait for some time while it does its magic.
This will result in a run_http.dist
directory containing compiled dependencies and an executable named run_http.exe
. This directory can be copied on any modern Windows setup and used without the need to install anything, not even the Python VM, which is provided. Running run_http.exe
will run the http
command from httpie
.
To make sure we won't confuse the users, I advice for renaming run_http.exe
into http.exe
after the fact. run_http.exe
is named this way because we compiled run_http.py
, but we can't call the script http.py
, this would result in import errors since this module exists in the stdlib.
You can zip and provide this directory as a portable version of httpie, which is very useful to have on a USB stick.
Generate an installer
- Install the large string build of NSIS, it will allow a maximum string length of 8192 bytes which is better when you deal with potentially long file system paths.
- Install the env var plugin, which let us manipulate the system PATH to add
http.exe
parent directory. - Write a NSI script. I provided the one I used as an example, named
httpie.nsi
. You will find some comments, but for a better understanding, you can use NSIS Quick Setup which is a UI generating scripts. - Use either NSIS UI or cmd to run the .nsi file and get the installer as a result. VSCode also has a nice plugin to do that for you. Careful, any utf8 file you manipulate (E.G: the licence file) must have a BOM to be used as such.
The result is an installer that will serve a piece of httpie to your happy Windows machine. You'll find it as install_httpie.exe
in the zip too. You can try it on an official pristine Windows dev VM to see that it does provide the http command, and a way to uninstall it.
Where to go from there:
- Optimize the compilation phase so that you don't include the entire stdlib.
- Automate the whole thing.
- Put an icon in there.
- Sign the binary.
- More robust PATH handling.
- Entry point should be a cmd.exe call, with httpie loaded in the PATH, not httpie directly.
- Handle updates.
- Create an e2e test in your CI infra.
- Upload to windows store ?
from httpie.
Someone on Twitter has also mentioned Chocolatey, which looks like a decent package manager for Windows. That should allow you to install HTTPie using this simple command:
cinst httpie -source python
from httpie.
@mercury2269 This is not the sort of thing I'm talking about here, people should get Httpie up and running without even having to install python.
Many people aren't python people and installing pip on windows is a hassle nobody should go through, not even python developers.
from httpie.
Would love to install it through Scoop with scoop install httpie
or choco install httpie
. It's okay if Python is a dependency.
This is a Python script and I guess Python is a requirement.
from httpie.
I was able to successfully build a stand-alone http.exe
binary inside of the mcr.microsoft.com/windows/servercore:ltsc2019
Docker container with Python 3.7.6 and PyInstaller 3.6. Docker Desktop 2.1.0.5 was used.
These are the commands...
Outside the Docker container:
mkdir c:\temp\outside
docker run -t -i --mount type=bind,src=c:\temp\outside,dst=c:\inside -w c:\ mcr.microsoft.com/windows/servercore:ltsc2019
You are now inside the Docker container:
curl -L https://aka.ms/nugetclidl -o nuget.exe
set PATH=%PATH%;c:\python\tools;c:\python\tools\scripts;c:\GitForWindows\tools\cmd
nuget install GitForWindows -ExcludeVersion
set PYVER=3.7.6
nuget install python -ExcludeVersion -Version %PYVER% -OutputDirectory .
python -m pip install --no-warn-script-location PyInstaller
python -m pip install pywin32
git clone https://github.com/jakubroztocil/httpie.git
cd httpie
python -m pip install -r requirements-dev.txt
python setup.py build
cd build\lib\httpie
echo sys.exit(main())>> core.py
pyinstaller -F --noupx -n http.exe core.py
cd dist
copy http.exe c:\inside
exit
You are now outside of the Docker container:
dir c:\temp\outside\http.exe
The resulting http.exe
has a size of 11,605,534
.
Could someone please confirm this procedure? Thanks.
EDIT:
A pre-built http.exe binary can be downloaded from here:
https://github.com/jftuga/HTTPie-Windows
Please read the Warnings section before using this.
from httpie.
https://github.com/jftuga/HTTPie-Windows
Please read the Warnings section before using this.
from httpie.
A Scoop alternative would be great
from httpie.
This is major problem for me as well. I am looking for an app like HTTPie, but portable exe. I need to debug reachability in clients LAN, but in production. Corporate environment. I definitelly won't install choco or python or pip ... you name it. I could use a single EXE, test it out and delete the EXE.
I guess I will have to build my own using Electron: unizp, test, delete - that's it. No system-wide hassle.
from httpie.
A Scoop alternative would be great
choco is kind of dead at this point, so winget (or scoop if winget is not palatable for some reason) would be nice for both cli and desktop.
from httpie.
Winget please: https://learn.microsoft.com/en-us/windows/package-manager/winget/
from httpie.
Scott Hanselman has a step by step guide on how to install it on windows
from httpie.
But that would require the user to have it installed, wouldn't a standalone installer be better?
Edit: I'll try to make a windows installer using py2exe and Inno Setup
from httpie.
Another option for packaging httpie as a standalone package that includes Python is PyInstaller. I haven't used it myself, but the project is very active.
You could probably even automate the process of generating a Windows package as part of httpie's CI using AppVeyor.
from httpie.
https://github.com/chocolatey/choco/wiki
from httpie.
I created a PowerShell script to install hpttpie and already pushed a PR, feel free to use this script to install on a windows machine.
from httpie.
Still no stand-alone .exe
for Windows like aria2c.exe, curl.exe, wget.exe
?
from httpie.
Yeah, installing httpie on a Windows machine without Internet access is a real pain, would also love a package like this. Unfortunately my personal skill aren't quite enought to create it myself yet...
from httpie.
Just noticed that issue asking for Windows package was created in 2012, whereas we are in 2017 now.
from httpie.
I'd be willing to create/maintain a package for Chocolatey. Let me know if this is still desired.
from httpie.
@jftuga, would you care to share your http.exe
with mere Windows users without compiler stuff?
from httpie.
@jftuga, works as expected, at least basic actions. Thank you, sir.
from httpie.
Anyone checked the Scoop-Python bucket ? Its by the maintainer of nonportable bucket.
scoop bucket add python https://github.com/TheRandomLabs/Scoop-Python.git
scoop install httpie-py
There is a migrate-python-packages
script that has to be run after every Python version update(every update for global install, major version update for user install).
from httpie.
FWIW, I came here looking for a Windows executable, don't want to install pip. Used the one linked above even though it isn't latest.
from httpie.
This is great. Thanks, @ksamuel! We’ll look into exploring this approach. 🧪
from httpie.
Note: there is also an unofficial choco build of HTTPie that we could automate and also use in this build.
I wonder what's the usage of choco vs windows store for CLI tools on Win. Research needed.
from httpie.
Updated the zip link, the last one expired but @jakubroztocil needed it: https://drop.chapril.org/download/3519a0235828b6d2/#Mwzt7QE4O1FnlDDIrUXjjg
It's still gonna expire in 5 days :)
from httpie.
@jkbrzt is there anything new regarding the approach of @ksamuel?
I am really interested to use the tool, but I prefer a portable approach without footprint of other things.
from httpie.
Related Issues (20)
- Trim trailing empty lines from CLI output HOT 1
- Cryptographic API Misuse Vulnerability : Missing SSL Certificate Validation HOT 1
- Filter response keys before print result to the screen
- HTTPie could be lead to believe data was passed in stdin when it was not HOT 1
- httpie -d does not work with gzip compressed content
- Add cli option to generate scriptable or compilable code, or a native executable, that performs the command wherein the option was included
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today:
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today:
- ## Acceptance Criteria
- it is not possible install for arm linux HOT 3
- Please add support for Mise
- conda-forge lists __win as a MatchSpec dependency for httpie=2.2.0 preventing installation on linux-64 HOT 1
- Failed to use {{key}}={{value}} for nested JSON HOT 1
- Online doc error HOT 3
- Ability to define a custom default user-agent in config.json
- Add .netrc support when using --auth-type bearer
- unable to CONTRIBUTING
- ### Summary
- server HOT 1
- CLI help doesn't show how to launch in a browser!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpie.