|
| 1 | +# Contributing to Wafer View |
| 2 | + |
| 3 | +Everybody is invited and welcome to contribute to Wafer View. |
| 4 | + |
| 5 | +The process is straight-forward. |
| 6 | + |
| 7 | + - Read [How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md#best-practices-for-faster-reviews) by Kubernetes (but skip step 0 and 1) |
| 8 | + - Fork Wafer View [git repository](https://github.com/fronzbot/wafer-view). |
| 9 | + - Write the code for your feature/improvement/bug fix |
| 10 | + - Ensure tests work. |
| 11 | + - Create a Pull Request against the [**dev**](https://github.com/fronzbot/wafer-view/tree/dev) branch of Wafer View. |
| 12 | + |
| 13 | +## Feature suggestions |
| 14 | + |
| 15 | +If you want to suggest a new feature for Home Assistant (e.g., new integrations), please open a thread in our [Community Forum: Feature Requests](https://community.home-assistant.io/c/feature-requests). |
| 16 | +We use [GitHub for tracking issues](https://github.com/home-assistant/core/issues), not for tracking feature requests. |
| 17 | + |
| 18 | +## Development Quick-Start |
| 19 | + |
| 20 | +#### Setup Local Repository |
| 21 | + |
| 22 | +```bash |
| 23 | +git clone git@github.com:<github-username>/wafer-view.git |
| 24 | +cd wafer-view |
| 25 | +git remote add upstream https://github.com/fronzbot/wafer-view.git |
| 26 | +``` |
| 27 | + |
| 28 | +#### Create a virtualenv and install dependencies |
| 29 | + |
| 30 | +First: if on linux, it's possible you need to install GTK3 for the GUI to work. Run the following commands (commands shown for debian): |
| 31 | + |
| 32 | +```bash |
| 33 | +sudo apt-get update |
| 34 | +sudo apt-get install build-essential libgtk-3-dev |
| 35 | +``` |
| 36 | + |
| 37 | +```bash |
| 38 | +python -m venv venv |
| 39 | +source venv/bin/activate |
| 40 | +pip install -r requirement.txt |
| 41 | +pip install -r requirements_test.txt |
| 42 | +pip install tox |
| 43 | +pip install -e . |
| 44 | +``` |
| 45 | + |
| 46 | +#### Create your feature branch |
| 47 | + |
| 48 | +```bash |
| 49 | +git checkout -b <branch-name> |
| 50 | +``` |
| 51 | + |
| 52 | +#### Make changes |
| 53 | + |
| 54 | +Now you can make changes to your code. Keep changes minimal (ie. if you're working on adding a new standard, don't also include GUI changes- make those separate PR's even if they're linked) |
| 55 | + |
| 56 | +#### Test changes |
| 57 | + |
| 58 | +To run all tests: |
| 59 | + |
| 60 | +```bash |
| 61 | +tox |
| 62 | +``` |
| 63 | + |
| 64 | +On Debian, it can take a long time to install wxPython inside the tox venv. As such, here are the commands you can use that do not rely on tox: |
| 65 | + |
| 66 | +For linting: |
| 67 | +```bash |
| 68 | +ruff check waferview tests |
| 69 | +black --check --diff waferview tests |
| 70 | +rst-lint README.rst |
| 71 | +``` |
| 72 | + |
| 73 | +For tests: |
| 74 | +```bash |
| 75 | +pytest --timeout=9 --durations=10 -cov=waferview --cov-report term-missing |
| 76 | +``` |
| 77 | + |
| 78 | +For new features, please add tests to ensure the feature works as intended and that any future changes do not break the intended behavior. |
| 79 | + |
| 80 | +#### Commit Changes |
| 81 | + |
| 82 | +```bash |
| 83 | +git add . |
| 84 | +git commit |
| 85 | +``` |
| 86 | + |
| 87 | +#### Catching up with dev |
| 88 | + |
| 89 | +If your code is taking a while to develop, you may be behind the `dev` branch, in which case you need to catch up before creating your pull-request. To do this you can run `git rebase` as follows (running this on your local branch): |
| 90 | + |
| 91 | +```bash |
| 92 | +git fetch upstream dev |
| 93 | +git rebase upstream/dev |
| 94 | +``` |
| 95 | + |
| 96 | +If rebase detects conflicts, repeat the following process until all changes have been resolved: |
| 97 | + |
| 98 | +1. git status shows you the filw with a conflict. You will need to edit that file and resolve the lines between `<<<< | >>>>` |
| 99 | +2. Add the modified file: `git add <file>` or `git add .` |
| 100 | +3. Continue rebase: `git rebase --continue` |
| 101 | +4. Repeat until all conflicts resolved |
| 102 | + |
| 103 | +#### Push and Submit PR |
| 104 | + |
| 105 | +Once you're ready to submit your PR, go ahead and push your changes to your fork: |
| 106 | + |
| 107 | +```bash |
| 108 | +git push origin <branch-name> |
| 109 | +``` |
| 110 | +1. On GitHub, navigate to the [wafer-view](https://github.com/fronzbot/wafer-view/tree/dev) repository. |
| 111 | +2. In the "Branch" menu, choose the branch that contains your commits (from your fork). |
| 112 | +3. To the right of the Branch menu, click New pull request. |
| 113 | +4. The base branch dropdown menu should read `dev`. Use the compare branch drop-down menu to choose the branch you made your changes in. |
| 114 | +5. Type a title and complete the provided description for your pull request. |
| 115 | +6. Click Create pull request. |
| 116 | +7. |
| 117 | +More detailed instructions can be found here: [Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request) |
0 commit comments