Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standalone installation using zipapp #822

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build-hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
concurrency:
group: build-hatch-${{ github.head_ref }}

env:
STABLE_PYTHON_VERSION: '3.11'

jobs:
build:
name: Build wheels and source distribution
Expand Down Expand Up @@ -46,3 +49,33 @@ jobs:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_HATCH }}

build-zipapp:
name: Build zipapp
needs:
- build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}

- name: Upgrade pip, Install shiv
run: |
python -m pip install --upgrade pip
pip install shiv

- name: Build zipapp
run: shiv -c hatch -o ./hatch.pyz .

- name: Test zipapp
run: python ./hatch.pyz --version

- name: Upload to releases
uses: softprops/action-gh-release@v1
with:
files: hatch.pyz
4 changes: 4 additions & 0 deletions docs/history/hatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

***Added:***

- Ship a [zipapp](https://docs.python.org/3/library/zipapp.html) of Hatch

## [1.7.0](https://github.com/pypa/hatch/releases/tag/hatch-v1.7.0) - 2023-04-03 ## {: #hatch-v1.7.0 }

***Changed:***
Expand Down
9 changes: 9 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ pip install hatch
pipx install hatch
```

## Standalone (via zipapp)

You can also use Hatch without installing it.
The zipapp can be downloaded from [Github releases](https://github.com/pypa/hatch/releases) and you can invoke it with a Python 3.7+ interpreter:

```
python hatch.pyz new --init
```

## Homebrew

See the [formula](https://formulae.brew.sh/formula/hatch) for more details.
Expand Down