zmk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. zmk-0.1.0/.github/workflows/release.yml +86 -0
  2. zmk-0.1.0/.gitignore +161 -0
  3. zmk-0.1.0/.pre-commit-config.yaml +22 -0
  4. zmk-0.1.0/.vscode/settings.json +25 -0
  5. zmk-0.1.0/LICENSE +21 -0
  6. zmk-0.1.0/PKG-INFO +290 -0
  7. zmk-0.1.0/README.md +241 -0
  8. zmk-0.1.0/pyproject.toml +49 -0
  9. zmk-0.1.0/setup.cfg +4 -0
  10. zmk-0.1.0/zmk/__init__.py +0 -0
  11. zmk-0.1.0/zmk/_version.py +16 -0
  12. zmk-0.1.0/zmk/backports.py +10 -0
  13. zmk-0.1.0/zmk/build.py +174 -0
  14. zmk-0.1.0/zmk/commands/__init__.py +28 -0
  15. zmk-0.1.0/zmk/commands/cd.py +56 -0
  16. zmk-0.1.0/zmk/commands/code.py +197 -0
  17. zmk-0.1.0/zmk/commands/config.py +83 -0
  18. zmk-0.1.0/zmk/commands/download.py +26 -0
  19. zmk-0.1.0/zmk/commands/init.py +134 -0
  20. zmk-0.1.0/zmk/commands/keyboard/__init__.py +21 -0
  21. zmk-0.1.0/zmk/commands/keyboard/add.py +164 -0
  22. zmk-0.1.0/zmk/commands/keyboard/list.py +201 -0
  23. zmk-0.1.0/zmk/commands/keyboard/new.py +356 -0
  24. zmk-0.1.0/zmk/commands/keyboard/remove.py +28 -0
  25. zmk-0.1.0/zmk/commands/module/__init__.py +19 -0
  26. zmk-0.1.0/zmk/commands/module/add.py +162 -0
  27. zmk-0.1.0/zmk/commands/module/list.py +36 -0
  28. zmk-0.1.0/zmk/commands/module/remove.py +113 -0
  29. zmk-0.1.0/zmk/commands/west.py +45 -0
  30. zmk-0.1.0/zmk/config.py +123 -0
  31. zmk-0.1.0/zmk/exceptions.py +52 -0
  32. zmk-0.1.0/zmk/hardware.py +234 -0
  33. zmk-0.1.0/zmk/main.py +57 -0
  34. zmk-0.1.0/zmk/menu.py +482 -0
  35. zmk-0.1.0/zmk/prompt.py +17 -0
  36. zmk-0.1.0/zmk/repo.py +238 -0
  37. zmk-0.1.0/zmk/styles.py +21 -0
  38. zmk-0.1.0/zmk/templates/__init__.py +82 -0
  39. zmk-0.1.0/zmk/templates/board/nrf52840/Kconfig +22 -0
  40. zmk-0.1.0/zmk/templates/board/nrf52840/Kconfig.defconfig +22 -0
  41. zmk-0.1.0/zmk/templates/board/nrf52840/board.cmake +5 -0
  42. zmk-0.1.0/zmk/templates/board/nrf52840/board.yaml +18 -0
  43. zmk-0.1.0/zmk/templates/board/nrf52840/board_defconfig +34 -0
  44. zmk-0.1.0/zmk/templates/board/nrf52840/common_inner.dtsi +29 -0
  45. zmk-0.1.0/zmk/templates/board/nrf52840/common_outer.dtsi +59 -0
  46. zmk-0.1.0/zmk/templates/board/nrf52840/pinctrl.dtsi +26 -0
  47. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}.conf +1 -0
  48. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}.dtsi +26 -0
  49. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}.keymap +1 -0
  50. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}.yaml +1 -0
  51. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}.zmk.yml +8 -0
  52. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_left-pinctrl.dtsi +1 -0
  53. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_left.dts +1 -0
  54. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_left_defconfig +1 -0
  55. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_right-pinctrl.dtsi +1 -0
  56. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_right.dts +1 -0
  57. zmk-0.1.0/zmk/templates/board/nrf52840/split/${id}_right_defconfig +1 -0
  58. zmk-0.1.0/zmk/templates/board/nrf52840/split/Kconfig +3 -0
  59. zmk-0.1.0/zmk/templates/board/nrf52840/split/Kconfig.board +7 -0
  60. zmk-0.1.0/zmk/templates/board/nrf52840/split/Kconfig.defconfig +16 -0
  61. zmk-0.1.0/zmk/templates/board/nrf52840/split/board.cmake +1 -0
  62. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}-pinctrl.dtsi +1 -0
  63. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}.conf +1 -0
  64. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}.dts +24 -0
  65. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}.keymap +1 -0
  66. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}.yaml +1 -0
  67. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}.zmk.yml +4 -0
  68. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/${id}_defconfig +1 -0
  69. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/Kconfig +3 -0
  70. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/Kconfig.board +3 -0
  71. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/Kconfig.defconfig +9 -0
  72. zmk-0.1.0/zmk/templates/board/nrf52840/unibody/board.cmake +1 -0
  73. zmk-0.1.0/zmk/templates/board/other/Kconfig +10 -0
  74. zmk-0.1.0/zmk/templates/board/other/Kconfig.defconfig +22 -0
  75. zmk-0.1.0/zmk/templates/board/other/board.cmake +6 -0
  76. zmk-0.1.0/zmk/templates/board/other/board.yaml +19 -0
  77. zmk-0.1.0/zmk/templates/board/other/board_defconfig +15 -0
  78. zmk-0.1.0/zmk/templates/board/other/pinctrl.dtsi +8 -0
  79. zmk-0.1.0/zmk/templates/board/other/split/${id}.conf +1 -0
  80. zmk-0.1.0/zmk/templates/board/other/split/${id}.dtsi +5 -0
  81. zmk-0.1.0/zmk/templates/board/other/split/${id}.keymap +1 -0
  82. zmk-0.1.0/zmk/templates/board/other/split/${id}.yaml +1 -0
  83. zmk-0.1.0/zmk/templates/board/other/split/${id}.zmk.yml +8 -0
  84. zmk-0.1.0/zmk/templates/board/other/split/${id}_left-pinctrl.dtsi +1 -0
  85. zmk-0.1.0/zmk/templates/board/other/split/${id}_left.dts +1 -0
  86. zmk-0.1.0/zmk/templates/board/other/split/${id}_left_defconfig +1 -0
  87. zmk-0.1.0/zmk/templates/board/other/split/${id}_right-pinctrl.dtsi +1 -0
  88. zmk-0.1.0/zmk/templates/board/other/split/${id}_right.dts +1 -0
  89. zmk-0.1.0/zmk/templates/board/other/split/${id}_right_defconfig +1 -0
  90. zmk-0.1.0/zmk/templates/board/other/split/Kconfig +3 -0
  91. zmk-0.1.0/zmk/templates/board/other/split/Kconfig.board +13 -0
  92. zmk-0.1.0/zmk/templates/board/other/split/Kconfig.defconfig +16 -0
  93. zmk-0.1.0/zmk/templates/board/other/split/board.cmake +1 -0
  94. zmk-0.1.0/zmk/templates/board/other/unibody/${id}-pinctrl.dtsi +1 -0
  95. zmk-0.1.0/zmk/templates/board/other/unibody/${id}.conf +1 -0
  96. zmk-0.1.0/zmk/templates/board/other/unibody/${id}.dts +5 -0
  97. zmk-0.1.0/zmk/templates/board/other/unibody/${id}.keymap +1 -0
  98. zmk-0.1.0/zmk/templates/board/other/unibody/${id}.yaml +1 -0
  99. zmk-0.1.0/zmk/templates/board/other/unibody/${id}.zmk.yml +4 -0
  100. zmk-0.1.0/zmk/templates/board/other/unibody/${id}_defconfig +1 -0
  101. zmk-0.1.0/zmk/templates/board/other/unibody/Kconfig +3 -0
  102. zmk-0.1.0/zmk/templates/board/other/unibody/Kconfig.board +8 -0
  103. zmk-0.1.0/zmk/templates/board/other/unibody/Kconfig.defconfig +9 -0
  104. zmk-0.1.0/zmk/templates/board/other/unibody/board.cmake +1 -0
  105. zmk-0.1.0/zmk/templates/common/board.dts +32 -0
  106. zmk-0.1.0/zmk/templates/common/board_left.dts +7 -0
  107. zmk-0.1.0/zmk/templates/common/board_right.dts +7 -0
  108. zmk-0.1.0/zmk/templates/common/board_split.dtsi +7 -0
  109. zmk-0.1.0/zmk/templates/common/default.conf +12 -0
  110. zmk-0.1.0/zmk/templates/common/hardware.zmk.yml +19 -0
  111. zmk-0.1.0/zmk/templates/common/keymap.dtsi +23 -0
  112. zmk-0.1.0/zmk/templates/common/keymap_split.dtsi +9 -0
  113. zmk-0.1.0/zmk/templates/common/kscan.dtsi +24 -0
  114. zmk-0.1.0/zmk/templates/common/kscan_split_common.dtsi +20 -0
  115. zmk-0.1.0/zmk/templates/common/kscan_split_left.dtsi +9 -0
  116. zmk-0.1.0/zmk/templates/common/kscan_split_right.dtsi +14 -0
  117. zmk-0.1.0/zmk/templates/common/matrix_transform.dtsi +12 -0
  118. zmk-0.1.0/zmk/templates/common/matrix_transform_split.dtsi +12 -0
  119. zmk-0.1.0/zmk/templates/common/shield.overlay +24 -0
  120. zmk-0.1.0/zmk/templates/common/shield_left.overlay +6 -0
  121. zmk-0.1.0/zmk/templates/common/shield_right.overlay +6 -0
  122. zmk-0.1.0/zmk/templates/shield/split/${id}.conf +1 -0
  123. zmk-0.1.0/zmk/templates/shield/split/${id}.dtsi +7 -0
  124. zmk-0.1.0/zmk/templates/shield/split/${id}.keymap +1 -0
  125. zmk-0.1.0/zmk/templates/shield/split/${id}.zmk.yml +5 -0
  126. zmk-0.1.0/zmk/templates/shield/split/${id}_left.overlay +1 -0
  127. zmk-0.1.0/zmk/templates/shield/split/${id}_right.overlay +1 -0
  128. zmk-0.1.0/zmk/templates/shield/split/Kconfig.defconfig +16 -0
  129. zmk-0.1.0/zmk/templates/shield/split/Kconfig.shield +5 -0
  130. zmk-0.1.0/zmk/templates/shield/unibody/${id}.conf +1 -0
  131. zmk-0.1.0/zmk/templates/shield/unibody/${id}.keymap +1 -0
  132. zmk-0.1.0/zmk/templates/shield/unibody/${id}.overlay +4 -0
  133. zmk-0.1.0/zmk/templates/shield/unibody/${id}.zmk.yml +5 -0
  134. zmk-0.1.0/zmk/templates/shield/unibody/Kconfig.defconfig +6 -0
  135. zmk-0.1.0/zmk/templates/shield/unibody/Kconfig.shield +2 -0
  136. zmk-0.1.0/zmk/terminal.py +179 -0
  137. zmk-0.1.0/zmk/util.py +53 -0
  138. zmk-0.1.0/zmk/yaml.py +64 -0
  139. zmk-0.1.0/zmk.egg-info/PKG-INFO +290 -0
  140. zmk-0.1.0/zmk.egg-info/SOURCES.txt +142 -0
  141. zmk-0.1.0/zmk.egg-info/dependency_links.txt +1 -0
  142. zmk-0.1.0/zmk.egg-info/entry_points.txt +2 -0
  143. zmk-0.1.0/zmk.egg-info/requires.txt +10 -0
  144. zmk-0.1.0/zmk.egg-info/top_level.txt +1 -0
@@ -0,0 +1,86 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["*"]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build distribution
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: ">=3.10"
17
+ - name: Install pypa/build
18
+ run: python3 -m pip install build --user
19
+ - name: Build wheel and source tarball
20
+ run: python3 -m build
21
+ - name: Store distribution packages
22
+ uses: actions/upload-artifact@v3
23
+ with:
24
+ name: python-package-distributions
25
+ path: dist/
26
+
27
+ publish-to-pypi:
28
+ name: Publish Python distribution to PyPI
29
+ needs:
30
+ - build
31
+ runs-on: ubuntu-latest
32
+ environment:
33
+ name: pypi
34
+ url: https://pypi.org/p/zmk
35
+ permissions:
36
+ id-token: write
37
+
38
+ steps:
39
+ - name: Download artifacts
40
+ uses: actions/download-artifact@v3
41
+ with:
42
+ name: python-package-distributions
43
+ path: dist/
44
+ - name: Publish to PyPI
45
+ uses: pypa/gh-action-pypi-publish@release/v1
46
+
47
+ github-release:
48
+ name: GitHub release
49
+ needs:
50
+ - publish-to-pypi
51
+ runs-on: ubuntu-latest
52
+
53
+ permissions:
54
+ contents: write
55
+ id-token: write
56
+
57
+ steps:
58
+ - name: Download artifacts
59
+ uses: actions/download-artifact@v3
60
+ with:
61
+ name: python-package-distributions
62
+ path: dist/
63
+ - name: Sign artifacts
64
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
65
+ with:
66
+ inputs: >-
67
+ ./dist/*.tar.gz
68
+ ./dist/*.whl
69
+ - name: Create GitHub release
70
+ env:
71
+ GITHUB_TOKEN: ${{ github.token }}
72
+ run: >-
73
+ gh release create
74
+ '${{ github.ref_name }}'
75
+ --repo '${{ github.repository }}'
76
+ --notes ""
77
+ - name: Upload artifact signatures to GitHub release
78
+ env:
79
+ GITHUB_TOKEN: ${{ github.token }}
80
+ # Upload to GitHub Release using the `gh` CLI.
81
+ # `dist/` contains the built packages, and the
82
+ # sigstore-produced signatures and certificates.
83
+ run: >-
84
+ gh release upload
85
+ '${{ github.ref_name }}' dist/**
86
+ --repo '${{ github.repository }}'
zmk-0.1.0/.gitignore ADDED
@@ -0,0 +1,161 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+ _version.py
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # poetry
99
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103
+ #poetry.lock
104
+
105
+ # pdm
106
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107
+ #pdm.lock
108
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109
+ # in version control.
110
+ # https://pdm.fming.dev/#use-with-ide
111
+ .pdm.toml
112
+
113
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114
+ __pypackages__/
115
+
116
+ # Celery stuff
117
+ celerybeat-schedule
118
+ celerybeat.pid
119
+
120
+ # SageMath parsed files
121
+ *.sage.py
122
+
123
+ # Environments
124
+ .env
125
+ .venv
126
+ env/
127
+ venv/
128
+ ENV/
129
+ env.bak/
130
+ venv.bak/
131
+
132
+ # Spyder project settings
133
+ .spyderproject
134
+ .spyproject
135
+
136
+ # Rope project settings
137
+ .ropeproject
138
+
139
+ # mkdocs documentation
140
+ /site
141
+
142
+ # mypy
143
+ .mypy_cache/
144
+ .dmypy.json
145
+ dmypy.json
146
+
147
+ # Pyre type checker
148
+ .pyre/
149
+
150
+ # pytype static type analyzer
151
+ .pytype/
152
+
153
+ # Cython debug symbols
154
+ cython_debug/
155
+
156
+ # PyCharm
157
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
160
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
161
+ #.idea/
@@ -0,0 +1,22 @@
1
+ fail_fast: false
2
+ repos:
3
+ - repo: https://github.com/psf/black
4
+ rev: "23.9.1"
5
+ hooks:
6
+ - id: black
7
+ - repo: https://github.com/pycqa/isort
8
+ rev: "5.13.2"
9
+ hooks:
10
+ - id: isort
11
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
12
+ rev: v1.5.2
13
+ hooks:
14
+ - id: remove-tabs
15
+ - repo: https://github.com/pre-commit/pre-commit-hooks
16
+ rev: v4.4.0
17
+ hooks:
18
+ - id: trailing-whitespace
19
+ - id: check-yaml
20
+ exclude: ^zmk/templates
21
+ - id: check-added-large-files
22
+ - id: check-shebang-scripts-are-executable
@@ -0,0 +1,25 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "[python]": {
4
+ "editor.defaultFormatter": "ms-python.black-formatter",
5
+ "editor.codeActionsOnSave": {
6
+ "source.organizeImports": "always"
7
+ }
8
+ },
9
+ "[markdown][yaml]": {
10
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
11
+ },
12
+ "[dts]": {
13
+ "editor.formatOnSave": false
14
+ },
15
+ "files.exclude": {
16
+ "**/__pycache__": true
17
+ },
18
+ "files.associations": {
19
+ "**/templates/board/**": "mako",
20
+ "**/templates/shield/**": "mako",
21
+ "**/templates/common/**": "mako"
22
+ },
23
+ "isort.check": true,
24
+ "isort.args": ["--profile", "black"]
25
+ }
zmk-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 The ZMK Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
zmk-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.1
2
+ Name: zmk
3
+ Version: 0.1.0
4
+ Summary: A command line program to help set up ZMK Firmware
5
+ License: MIT License
6
+
7
+ Copyright (c) 2023 The ZMK Contributors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ Project-URL: Documentation, https://zmk.dev/docs
27
+ Project-URL: Source Code, https://github.com/zmkfirmware/zmk-cli/
28
+ Project-URL: Issue Tracker, https://github.com/zmkfirmware/zmk-cli/issues/
29
+ Project-URL: Chat, https://zmk.dev/community/discord/invite
30
+ Classifier: Development Status :: 3 - Alpha
31
+ Classifier: Environment :: Console
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Intended Audience :: End Users/Desktop
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Topic :: Software Development
37
+ Classifier: Topic :: Utilities
38
+ Requires-Python: >=3.10
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: backports.strenum; python_version < "3.11"
42
+ Requires-Dist: dacite<2.0.0,>=1.8.1
43
+ Requires-Dist: mako<2.0.0,>=1.3.3
44
+ Requires-Dist: rich<14.0.0,>=13.6.0
45
+ Requires-Dist: ruamel.yaml<0.19.0,>=0.18.6
46
+ Requires-Dist: shellingham<2.0.0,>=1.5.3
47
+ Requires-Dist: typer<0.13.0,>=0.12.0
48
+ Requires-Dist: west<2.0.0,>=1.2.0
49
+
50
+ # ZMK CLI
51
+
52
+ A command line program to help set up [ZMK Firmware](https://zmk.dev).
53
+
54
+ ZMK CLI walks you through installing ZMK and setting up a GitHub repository to store and build custom firmware. It also automates some common tasks such as adding new keyboards to your repository.
55
+
56
+ The instructions below contain commands that need to be run in a terminal program. On Windows, use the [Windows Terminal](https://apps.microsoft.com/detail/9n0dx20hk701) or PowerShell. On other operating systems, the terminal program is usually just named "Terminal".
57
+
58
+ # Installation
59
+
60
+ ## Install Git
61
+
62
+ Install Git from https://git-scm.com/downloads.
63
+
64
+ If you have Windows 11, you can instead open a terminal and run:
65
+
66
+ ```
67
+ winget install git.git
68
+ ```
69
+
70
+ ## Install Python
71
+
72
+ ZMK CLI requires Python 3.10 or newer.
73
+
74
+ ### On Windows and macOS
75
+
76
+ Install the latest version of Python from https://www.python.org/downloads/.
77
+
78
+ If you have Windows 11, you can instead open a terminal and run:
79
+
80
+ ```sh
81
+ winget install python3
82
+ ```
83
+
84
+ ### On Linux
85
+
86
+ Most Linux distributions come with Python already installed. Open a terminal and run the following command to check its version:
87
+
88
+ ```sh
89
+ python3 --version
90
+ ```
91
+
92
+ If Python is not installed, install `python3` with your package manager.
93
+
94
+ 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:
95
+
96
+ ```sh
97
+ sudo add-apt-repository ppa:deadsnakes/ppa
98
+ sudo apt install python3.10
99
+ ```
100
+
101
+ You will then need to replace `python3` with `python3.10` in the rest of the installation instructions.
102
+
103
+ ## Install pipx
104
+
105
+ ZMK CLI can be installed with pip, but using [pipx](https://github.com/pypa/pipx) is recommended to avoid conflicts between Python packages.
106
+
107
+ ### On Windows and Linux
108
+
109
+ Open a terminal and run:
110
+
111
+ ```sh
112
+ python3 -m pip install --user pipx
113
+ python3 -m pipx ensurepath
114
+ ```
115
+
116
+ 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.
117
+
118
+ Close and reopen your terminal, then run the following command. It should print a version number if everything is installed correctly:
119
+
120
+ ```sh
121
+ pipx --version
122
+ ```
123
+
124
+ ### On macOS
125
+
126
+ Open Terminal and run:
127
+
128
+ ```
129
+ brew install pipx
130
+ pipx ensurepath
131
+ ```
132
+
133
+ ## Install ZMK CLI
134
+
135
+ Next, run the following commands:
136
+
137
+ ```sh
138
+ pipx install zmk
139
+ zmk --help
140
+ ```
141
+
142
+ It should print a help message if everything installed correctly.
143
+
144
+ 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.
145
+
146
+ # Usage
147
+
148
+ All ZMK CLI commands start with `zmk`. Run `zmk --help` for general usage instructions. For help with a specific subcommand, add `--help` after the subcommand, e.g. `zmk init --help`.
149
+
150
+ ## Initialize a Repository
151
+
152
+ > ⚠️ If you have already created a repo and cloned it to your computer, you do not need to run this command. Set the [user.home](#userhome) setting to point to the existing repo instead.
153
+
154
+ The `zmk init` command walks you through creating a GitHub repository, then clones it to your computer so you can edit it.
155
+
156
+ Open a terminal and use the `cd` command to move to a directory where you'd like to place the ZMK files, then run `zmk init`. For example:
157
+
158
+ ```sh
159
+ cd ~/Documents
160
+ zmk init
161
+ ```
162
+
163
+ Follow the instructions it gives you. If you already have a ZMK config repo, you can enter its URL when prompted, for example:
164
+
165
+ ```
166
+ Repository URL: https://github.com/myusername/zmk-config
167
+ ```
168
+
169
+ Otherwise, leave this first prompt blank and press <kbd>Enter</kbd>, and it will walk you through creating a new repo.
170
+
171
+ Once you finish following all the instructions, you will have a copy of the repo stored on your computer. All `zmk` commands will run on this repo (unless the working directory is inside a different repo). If you ever forget where the repo is located, you can run `zmk cd` to find it.
172
+
173
+ Now that you have a repo created, see [Customizing ZMK](https://zmk.dev/docs/customization) for documentation on how to customize it, and see the instructions below for how ZMK CLI can automate some common tasks.
174
+
175
+ ## Keyboard Management
176
+
177
+ ### Add a Keyboard
178
+
179
+ To start building firmware for a new keyboard, run `zmk keyboard add`. Follow the instructions to select a keyboard (and controller board if necessary), and it will add it to the list of firmware to build and copy a default keymap into your repo.
180
+
181
+ You can then run `zmk code <keyboard>` to open the keymap in a text editor.
182
+
183
+ This command reads from a local copy of ZMK to determine the supported keyboards. If the keyboard you want to use isn't listed, try running `zmk update` to update the local copy to the latest version of ZMK. If it still isn't listed, you may be able to find a [Zephyr module](#module-management) that provides it, you you may need to [create it yourself](#create-a-new-keyboard).
184
+
185
+ ### Remove a keyboard
186
+
187
+ To remove a keyboard from the build, run `zmk keyboard remove` and select the item to remove. For a split keyboard, you will need to run this twice and remove the left and right sides.
188
+
189
+ This simply removes a keyboard from the `build.yaml` file. It does not delete any `.keymap` or `.conf` files.
190
+
191
+ ### List Supported Keyboards
192
+
193
+ Run `zmk keyboard list` to print a list of supported keyboard hardware.
194
+
195
+ ### Create a New Keyboard
196
+
197
+ If ZMK doesn't support your keyboard yet, you can run `zmk keyboard new` to create a new keyboard from a template.
198
+
199
+ This won't walk you through all of the details of adding support for a new keyboard, but it will generate most of the boilerplate for you. See the [New Keyboard Shield](https://zmk.dev/docs/development/new-shield) guide for how to finish writing the keyboard files.
200
+
201
+ ## Module Management
202
+
203
+ [Zephyr modules](https://docs.zephyrproject.org/3.6.0/develop/modules.html) can add support for new keyboards, behaviors, and other features to ZMK. Use the `zmk module` command to install modules into your repo:
204
+
205
+ ```sh
206
+ zmk module add # Add a module
207
+ zmk module remove # Remove an installed module
208
+ zmk module list # List the installed modules
209
+ zmk update # Update the local copies of ZMK and modules to their latest versions
210
+ ```
211
+
212
+ ## Edit Keymap and Config Files
213
+
214
+ The `zmk code` command will open ZMK files in a text editor:
215
+
216
+ ```sh
217
+ zmk code # Open the repo directory in an editor
218
+ zmk code <keyboard> # Open <keyboard>.keymap in an editor
219
+ zmk code --conf <keyboard> # Open <keyboard>.conf in an editor
220
+ zmk code --build # Open build.yaml in an editor
221
+ ```
222
+
223
+ The first time you run this command, it will ask you which editor you want to use. If you want to change this choice later or use an editor that wasn't listed, see the [core.editor](#coreeditor) and [code.explorer](#coreexplorer) settings.
224
+
225
+ ## Push Changes to GitHub
226
+
227
+ Run `zmk cd` to go to the repo directory. From here, you can run `git` commands manage the repo.
228
+
229
+ For example, after adding a keyboard to your repo and editing its keymap, you can run the following commands to push your changes to GitHub and trigger a firmware build:
230
+
231
+ ```sh
232
+ git add .
233
+ git commit
234
+ git push
235
+ ```
236
+
237
+ You will need to [authenticate with GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#authenticating-with-the-command-line) before the `git push` command will work. The easiest way to do this is to install the [GitHub CLI](https://cli.github.com/) and run
238
+
239
+ ```sh
240
+ gh auth login
241
+ ```
242
+
243
+ but you can also use a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). If using an access token, make sure you create it with the "workflow" scope option selected.
244
+
245
+ ## Download Firmware from GitHub
246
+
247
+ After pushing changes, GitHub will automatically build the firmware for you. Run `zmk download` (or `zmk dl` for short) to open the GitHub actions page in your browser.
248
+
249
+ From this page, you can click on a build (the latest is at the top) to view its status. If the build succeeded, you can download the firmware from the "Artifacts" section at the bottom of the build summary page.
250
+
251
+ ## Configuration
252
+
253
+ The `zmk config` command manages settings for ZMK CLI:
254
+
255
+ ```sh
256
+ zmk config # List all settings
257
+ zmk config <name> # Print the value of the setting <name>
258
+ zmk config <name> <value> # Set <name> to <value>
259
+ zmk config --unset <name> # Remove the setting <name>
260
+ ```
261
+
262
+ By default, these settings are stored in a file in your user profile directory. Run `zmk config --path` to get the location of this file. You can change where the settings file is stored by setting a `ZMK_CLI_CONFIG` environment variable to the new path to use, or by adding a `--config-file=<path>` argument when running `zmk`.
263
+
264
+ Other commands use the following settings:
265
+
266
+ ### core.editor
267
+
268
+ Command line for a text editor to use with the `zmk code` command.
269
+
270
+ For example, so set Visual Studio Code as the editor and make it always open a new window, run:
271
+
272
+ ```sh
273
+ zmk config core.editor "code --new-window"
274
+ ```
275
+
276
+ ### core.explorer
277
+
278
+ Command line for a file explorer to use with the `zmk code` command when opening a directory.
279
+
280
+ If this setting is not set, the `core.editor` tool will be run instead. Set this setting when using a text editor that does not support opening directories.
281
+
282
+ ### user.home
283
+
284
+ The path to the repository to use whenever `zmk` is run and the working directory is not inside a ZMK config repository.
285
+
286
+ For example, to point ZMK CLI to an existing repo at `~/Documents/zmk-config`, run:
287
+
288
+ ```sh
289
+ zmk config user.home ~/Documents/zmk-config
290
+ ```