summaryrefslogtreecommitdiff
path: root/docs/python_development.md
diff options
context:
space:
mode:
authorskullydazed <skullydazed@users.noreply.github.com>2019-09-22 13:25:33 -0700
committerGitHub <noreply@github.com>2019-09-22 13:25:33 -0700
commitd569f0877155efc752994f8a21f5cf001f9d6ae6 (patch)
treeeb58a3e3f916d6d938d8f05742d48919c053a579 /docs/python_development.md
parent2f49cae9bcbdd94431659727ef75cfd30f557da8 (diff)
Configuration system for CLI (#6708)
* Rework how bin/qmk handles subcommands * qmk config wip * Code to show all configs * Fully working `qmk config` command * Mark some CLI arguments so they don't pollute the config file * Fleshed out config support, nicer subcommand support * sync with installable cli * pyformat * Add a test for subcommand_modules * Documentation for the `qmk config` command * split config_token on space so qmk config is more predictable * Rework how subcommands are imported * Document `arg_only` * Document deleting from CLI * Document how multiple operations work * Add cli config to the doc index * Add tests for the cli commands * Make running the tests more reliable * Be more selective about building all default keymaps * Update new-keymap to fit the new subcommand style * Add documentation about writing CLI scripts * Document new-keyboard * Update docs/cli_configuration.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Address yan's comments. * Apply suggestions from code review suggestions from @noahfrederick Co-Authored-By: Noah Frederick <code@noahfrederick.com> * Apply suggestions from code review Co-Authored-By: Noah Frederick <code@noahfrederick.com> * Remove pip3 from the test runner
Diffstat (limited to 'docs/python_development.md')
-rw-r--r--docs/python_development.md45
1 files changed, 0 insertions, 45 deletions
diff --git a/docs/python_development.md b/docs/python_development.md
deleted file mode 100644
index b976a7c0e8..0000000000
--- a/docs/python_development.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# Python Development in QMK
-
-This document gives an overview of how QMK has structured its python code. You should read this before working on any of the python code.
-
-## Script directories
-
-There are two places scripts live in QMK: `qmk_firmware/bin` and `qmk_firmware/util`. You should use `bin` for any python scripts that utilize the `qmk` wrapper. Scripts that are standalone and not run very often live in `util`.
-
-We discourage putting anything into `bin` that does not utilize the `qmk` wrapper. If you think you have a good reason for doing so please talk to us about your use case.
-
-## Python Modules
-
-Most of the QMK python modules can be found in `qmk_firmware/lib/python`. This is the path that we append to `sys.path`.
-
-We have a module hierarchy under that path:
-
-* `qmk_firmware/lib/python`
- * `milc.py` - The CLI library we use. Will be pulled out into its own module in the future.
- * `qmk` - Code associated with QMK
- * `cli` - Modules that will be imported for CLI commands.
- * `errors.py` - Errors that can be raised within QMK apps
- * `keymap.py` - Functions for working with keymaps
-
-## CLI Scripts
-
-We have a CLI wrapper that you should utilize for any user facing scripts. We think it's pretty easy to use and it gives you a lot of nice things for free.
-
-To use the wrapper simply place a module into `qmk_firmware/lib/python/qmk/cli`, and create a symlink to `bin/qmk` named after your module. Dashes in command names will be converted into dots so you can use hierarchy to manage commands.
-
-When `qmk` is run it checks to see how it was invoked. If it was invoked as `qmk` the module name is take from `sys.argv[1]`. If it was invoked as `qmk-<module-name>` then everything after the first dash is taken as the module name. Dashes and underscores are converted to dots, and then `qmk.cli` is prepended before the module is imported.
-
-The module uses `@cli.entrypoint()` and `@cli.argument()` decorators to define an entrypoint, which is where execution starts.
-
-## Example CLI Script
-
-We have provided a QMK Hello World script you can use as an example. To run it simply run `qmk hello` or `qmk-hello`. The source code is listed below.
-
-```
-from milc import cli
-
-@cli.argument('-n', '--name', default='World', help='Name to greet.')
-@cli.entrypoint('QMK Python Hello World.')
-def main(cli):
- cli.echo('Hello, %s!', cli.config.general.name)
-```