Skip to content

Commit 7b1c50f

Browse files
committed
add zipapp build doc, and add to sidebar
1 parent e577828 commit 7b1c50f

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

docs/setup.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ pipx upgrade chk
2323
```
2424

2525
Otherwise, if _pip_ was used to install then same process given above should work for upgrade as well.
26+
27+
Alternatively, chkware tool can be build and use as a zipapp, [following this instruction](/setup/build-zipapp).

docs/setup/build-zipapp.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: Build cli zipapp
3+
---
4+
5+
CHKware `zipapp` is a self contained executable alike utility that once build can be used from anywhere. However, it have python version dependency.
6+
7+
Follow these steps to bundle `chkware` as [zipapp](https://docs.python.org/3/library/zipapp.html).
8+
9+
- Please confirm that [Python 3.11.x](https://www.python.org/downloads) is installed and setup on this machine
10+
11+
- Clone the repo
12+
13+
```bash
14+
git clone https://github.com/chkware/cli.git cli-zip
15+
```
16+
17+
- Change to the directory
18+
19+
```bash
20+
cd cli-zip
21+
```
22+
23+
- Make directory for local _virtualenv_ setup
24+
25+
```bash
26+
python -m venv .venv
27+
```
28+
29+
- Switch to the _virtualenv_
30+
31+
```bash
32+
source .venv/bin/activate
33+
```
34+
35+
or on windows
36+
37+
```bash
38+
.venv/Scripts/activate.bat
39+
```
40+
41+
- Install all required packages
42+
43+
```bash
44+
pip install -U -r requirements.txt
45+
```
46+
47+
- Install shiv for building the zipapp
48+
49+
```bash
50+
pip install -U shiv
51+
```
52+
53+
- Use the environment's python to build the zipapp. Refer to shiv [documentation](https://shiv.readthedocs.io/en/latest/#:~:text=let%E2%80%99s%20break%20this%20command%20down%2C) for further explanation.
54+
55+
```bash
56+
python -m shiv -c chk -o chk.pyz .
57+
```
58+
59+
- `chk.pyz` is generated in the project folder. You can move it to anywhere on your machine, and put it on your machine's environment variable or `$PATH`. Then, use it as follows:
60+
61+
```bash
62+
chk.pyz http tests/resources/storage/sample_config/xkcd-joke.chk
63+
```

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const sidebars = {
7070
"setup/setup-ext-dev",
7171
"setup/setup-cli-dev",
7272
"setup/setup-site-dev",
73+
"setup/build-zipapp",
7374
],
7475
},
7576
],

0 commit comments

Comments
 (0)