|
1 | | -### Hey there! So you've decided to contribute to the plugin. Here's what you need to know. |
| 1 | +# Contribution Guidelines |
2 | 2 |
|
3 | | -Please take note of the few things below for contributing to the plugin, it's not extensive and designed to make contributions as smooth as possible |
| 3 | +First, thank you for considering contributing to this project! |
4 | 4 |
|
5 | | -- Please only create pull requests against: |
6 | | - - `maintenance` for bug fixes or improvements |
7 | | - - `devel` for new features |
8 | | - - Never `master`, as this is downloaded by users so must remain untouched until release. (EXCEPTION: Documentation, like this) |
9 | | -- If your changes are large or disruptive, please open an issue first to dicuss. There may be things in the pipeline that would conflict |
10 | | -- Read the detail below so you understand how the plugin works! |
| 5 | +The guidelines here aim to make it as smooth as possible for contributors to understand how to contribute, what they can contribute |
| 6 | +and how the plugin works. |
11 | 7 |
|
12 | | -### How does it work? |
| 8 | +There's a couple of things to consider before making your contribution: |
13 | 9 |
|
14 | | -This plugin is currently written with 2 layers: |
| 10 | +- Please create pull requests against the `devel` branch unless indicated otherwise. |
| 11 | + There is an exception to this rule: documentation. See more below. |
15 | 12 |
|
16 | | -- The OctoPrint plugin class, |
17 | | -- The effect runner class. |
| 13 | +- If your changes are large or disruptive, please open an issue first so that we can discuss. I don't want you to put in a lot |
| 14 | + of work only for it to end up going to waste as there were already different plans. |
18 | 15 |
|
19 | | -When a user starts the plugin, OctoPrint loads the plugin class. This spins off a new process of the effect runner class, which handles driving the LEDs |
| 16 | +- Read the additional points below for details on code style, testing and how everything fits together. |
20 | 17 |
|
21 | | -Operating flow goes a bit like this: |
| 18 | +### Documentation |
22 | 19 |
|
23 | | -- Event recieved by the plugin class (This may be an OctoPrint event, gcode command or pressing the on/off button.) |
24 | | -- Evaluated, and decide what to do happens plugin side. Message constructed |
25 | | -- Message put in a queue through to the effect runner class. Any active effect is stopped immediately and message is read |
26 | | -- Analyse message, and decide what effect to run |
| 20 | +Contributing documentation changes is easy, since everything is formatted using markdown. The docs are built from |
| 21 | +the `docs` sub folder by GitBook, hosted at https://cp2004.gitbook.io/ws281x-led-status/. |
27 | 22 |
|
28 | | -All effects are kept in the sub-module `effects`, while there are useful functions that can be called cross module in the `util.py` file |
| 23 | +For the documentation for the current release of the plugin, please make it against the branch labelled for the minor version. (Currently `0.7.x`) |
| 24 | +This means that I can keep them versioned and not break things between releases. |
| 25 | + |
| 26 | +When contributing additional features or configuration please try to document it where necessary, however do not put |
| 27 | +off your contribution because you are struggling to document it! |
| 28 | + |
| 29 | +### Code style |
| 30 | + |
| 31 | +The plugin has a pre-commit setup that runs black, prettier, isort and various other code-mods. |
| 32 | + |
| 33 | +You can either set this up as a file watcher [as in the PyCharm example in OctoPrint's documentation (under pre-commit)](https://docs.octoprint.org/en/master/development/environment.html#pycharm). |
| 34 | + |
| 35 | +You can also run this as a one-off using `pre-commit run --hook-stage manual --all-files`. |
| 36 | + |
| 37 | +### Testing |
| 38 | + |
| 39 | +Running the unit tests is simple, though they require additional dependencies. |
| 40 | + |
| 41 | +If you installed OctoPrint in a development environment, using `pip install octoprint[develop]` or `pip install -e .[develop]` (in the checkout) |
| 42 | +these are already there. Otherwise, install them using `pip install pytest mock` |
| 43 | + |
| 44 | +Run it: `pytest` (or `python -m pytest`) |
| 45 | + |
| 46 | +### Anything else? |
| 47 | + |
| 48 | +Nothing else important! Give your PR a suitable description and let me merge it :) |
0 commit comments