home-assistant.io/source/developers/development_environment.markdown
Josh Wright ca6955ff24 Suggest the flake8 git commit hook (#408)
Given the number of PRs that require style cleanups, it seems like it might be helpful to suggest users add the flake8 commit hook, to catch issues before they get committed to the repo.
2016-04-19 18:50:29 -07:00

3.2 KiB

layout, title, description, date, sidebar, comments, sharing, footer
layout title description date sidebar comments sharing footer
page Setup Development Everything to get you started developing for Home Assistant. 2014-12-21 13:32 true false true true

Home Assistant is built from the ground up to be easily-extensible by other developers using components. It uses Python 3 for the backend and Polymer (Web components) for the frontend.

Home Assistant is open-source and MIT licensed. The source can be found here:

{% linkable_title Starting development %}

You will need to set up a development environment if you want to start developing a new feature or component for Home Assistant. Please follow these steps to get setup. Visit the the Home Assistant repository first and click fork in the top right.

We suggest that you setup a virtual environment aka venv before running the setup script.

$ git clone https://github.com/YOUR_GIT_USERNAME/home-assistant.git
$ cd home-assistant
$ git remote add upstream https://github.com/home-assistant/home-assistant.git
$ script/setup

Testing your work requires tox to be installed:

$ pip3 install tox

After following these steps, running hass will invoke your local installation.

{% linkable_title Prevent Linter Errors %}

Home Assistant enforces strict PEP8 style compliance on all code submitted. You can save yourself the hassle of extra commits just to fix style errors by enabling the flake8 git commit hook. It will check your code when you attempt to commit to the repo. It will block the commit if there are any style issues, giving you a chance to fix it.

$ pip install flake8
$ flake8 --install-hook

{% linkable_title Submitting improvements %}

Improvements to Home Assistant should be submitted one feature at a time using GitHub pull requests.

  1. From your fork, create a new branch to hold your changes git checkout -b some-feature
  2. Make the changes you want
  3. Test your changes and check for style violations tox
  4. Commit the changes git add . git commit -m "Added some-feature"
  5. Push your committed changes back to your fork on GitHub git push origin HEAD
  6. Follow these steps to create your pull request.

{% linkable_title Further reading %}