To hack on the HTTPie Snap packaging, you should use a Docker container to ensure a clean environment. Follow these steps to clone, build, install, and test the snap locally.
1. Launch the development environment
Pull and run the latest Ubuntu image:
docker pull ubuntu/latest
docker run -it --rm ubuntu/latest
2. Clone and Build
Inside the container, clone the repository and run snapcraft with specific resource allocations:
git clone --depth=1 https://github.com/httpie/cli.git
cd httpie
export SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8
export SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G
snapcraft --debug
3. Install and Test
Install the generated .snap file using the --dangerous flag (required for local files not from the store).
Note: Auto-aliases (like http and https) cannot be tested when installing a snap manually outside of the Snap Store. You must use the explicit httpie.http and httpie.https commands for testing.
sudo snap install --dangerous httpie_XXX_amd64.snap
# Test using explicit commands
httpie.http --version
httpie.https --version
4. Cleanup
To remove the locally installed snap:
sudo snap remove httpie
# Clone
git clone --depth=1 https://github.com/httpie/cli.git
cd httpie
# Build
export SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8
export SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G
snapcraft --debug
# Install
sudo snap install --dangerous httpie_XXX_amd64.snap
# Test
httpie.http --version
httpie.https --version
# Remove
sudo snap remove httpie