You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switched from Pip to uv for package management, Black, isort, and Pylint
to Ruff for linting and formatting, and pre-commit to prek for commit
hooks. These are faster and/or easier to work with.
Added an initial set of Ruff checks and updated the codebase to address
issues detected by them.
The minimum Python version of 3.10 was originally set based on what is
provided with Ubuntu 22.04 LTS. Now that we're instructing users to
install ZMK CLI with uv though, we're no longer dependent on the system
Python version. Updated to 3.11 to remove the need for the StrEnum
backport.
Copy file name to clipboardExpand all lines: README.md
+39-87Lines changed: 39 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,100 +8,30 @@ The instructions below contain commands that need to be run in a terminal progra
8
8
9
9
# Installation
10
10
11
-
## Install Git
12
-
13
-
Install Git from https://git-scm.com/downloads.
14
-
15
-
If you have Windows 11, you can instead open a terminal and run:
16
-
17
-
```sh
18
-
winget install git.git -i
19
-
```
20
-
21
-
The Windows installer will give you lots of options. You can leave all of them as their defaults, but when you get to the "choosing the default editor used by Git" screen, you may want to select a different text editor to use when writing Git commit messages.
22
-
23
-
## Install Python
24
-
25
-
ZMK CLI requires Python 3.10 or newer.
26
-
27
-
### On Windows and macOS
28
-
29
-
Install the latest version of Python from https://www.python.org/downloads/.
30
-
31
-
If you have Windows 11, you can instead open a terminal and run:
32
-
33
-
```sh
34
-
winget install python3
35
-
```
36
-
37
-
### On Linux
38
-
39
-
Most Linux distributions come with Python already installed. Open a terminal and run the following command to check its version:
40
-
41
-
```sh
42
-
python3 --version
43
-
```
44
-
45
-
If Python is not installed, install `python3` with your package manager.
46
-
47
-
If the version is older than 3.10, you will need to find and install a package for a newer version of Python. On Ubuntu 20.04 and older, you can get Python 3.10 from the deadsnakes PPA with the following commands:
48
-
49
-
```sh
50
-
sudo add-apt-repository ppa:deadsnakes/ppa
51
-
sudo apt install python3.10
52
-
```
53
-
54
-
You will then need to replace `python3` with `python3.10` in the rest of the installation instructions.
55
-
56
-
## Install pipx
11
+
This readme will provide brief instructions for installing ZMK CLI. For instructions in more detail, see the [ZMK Documentation](https://zmk.dev/docs/user-setup).
57
12
58
-
ZMK CLI can be installed with pip, but using [pipx](https://github.com/pypa/pipx) is recommended to avoid conflicts between Python packages.
59
-
60
-
### On Windows and Linux
61
-
62
-
Open a terminal and run:
63
-
64
-
```sh
65
-
python3 -m pip install --user pipx
66
-
python3 -m pipx ensurepath
67
-
```
68
-
69
-
Some Linux distributions may disallow installing packages with pip. If this gives you an error, see the [install instructions](https://github.com/pypa/pipx?tab=readme-ov-file#on-linux) specific to your distribution.
70
-
71
-
Close and reopen your terminal, then run the following command. It should print a version number if everything is installed correctly:
13
+
## Install Git
72
14
73
-
```sh
74
-
pipx --version
75
-
```
15
+
Install Git from https://git-scm.com/downloads or your OS's package manager.
76
16
77
-
### On macOS
17
+
You will also need a [GitHub account](https://github.com/signup).
78
18
79
-
Open Terminal and run:
19
+
## Install uv
80
20
81
-
```
82
-
brew install pipx
83
-
pipx ensurepath
84
-
```
21
+
Install uv from https://docs.astral.sh/uv/getting-started/installation/.
85
22
86
23
## Install ZMK CLI
87
24
88
-
Next, run the following commands:
25
+
Run the following command to install ZMK CLI:
89
26
90
27
```sh
91
-
pipx install zmk
92
-
zmk --help
28
+
uv tool install zmk
93
29
```
94
30
95
-
It should print a help message if everything installed correctly.
96
-
97
-
On Linux, you may get an error saying you need to install another package such as `python3.10-venv`. If so, follow the instructions in the error message, then try the above commands again.
98
-
99
-
## Update ZMK CLI
100
-
101
31
If you have already installed ZMK CLI, you can update to the latest version with the following command:
If you would like to help improve ZMK CLI, you can clone this repo and install it in editable mode so your changes to the code apply when you run `zmk`. First, open a terminal to the root directory of the repository.
205
+
If you would like to help improve ZMK CLI, you can clone this repo and install it into a virtual environment where you can modify it. First, open a terminal to the root directory of the repository. Then, create a virtual environment and install the project's dependencies:
206
+
207
+
```sh
208
+
# Create virtual environment and install dependencies
209
+
uv sync
210
+
# Install pre-commit hooks
211
+
uv run prek install
212
+
```
213
+
214
+
To run the development version of the program, either prefix commands with `uv run`...
215
+
216
+
```sh
217
+
uv run zmk <args...>
218
+
```
219
+
220
+
...or [activate the virtual environment](https://docs.astral.sh/uv/pip/environments/#using-a-virtual-environment) first, and then you can use just `zmk`.
221
+
222
+
If you want `zmk` to run the development version even when you are not inside the virtual environment, you can install it globally in editable mode:
223
+
224
+
```sh
225
+
uv tool install -e .
226
+
```
276
227
277
-
You may optionally run the following commands inside a [virtual environment](https://docs.python.org/3/library/venv.html) if you don't want to install ZMK CLI's dependencies globally or if your OS disallows doing this.
228
+
## Linting
278
229
279
-
To install ZMK CLI in editable mode, run:
230
+
After running `uv run prek install`, linting and code formatting will be run automatically when you make a commit. You can also run these tools manually:
280
231
281
232
```sh
282
-
pip install -e ".[dev]"
283
-
pre-commit install
233
+
# lint codebase
234
+
uv run ruff check
235
+
# format files
236
+
uv run ruff format
284
237
```
285
238
286
-
After running `pre-commit install`, your code will be checked when you make a commit, but there are some slower checks that do not run automatically. To run these additional checks, run these commands:
239
+
Type checking is slower and difficult to configure to run as a Git commit hook, so this needs to be run manually.
287
240
288
241
```sh
289
-
pyright .
290
-
pylint zmk
242
+
uv run pyright .
291
243
```
292
244
293
245
GitHub will also run these checks and report any errors when you make a pull request.
0 commit comments