Ville Skyttä 770185004b
Code block improvements (#382)
* Use f-strings instead of .format()

* Code block language marker fixes

* Make example code blocks syntactically valid Python

* Run all python code blocks through black

https://github.com/scop/misc/blob/master/black_markdown.py

* Add some missing code block language markers

* Use shell language consistently to mark shell code blocks

* Undo folding of some example dicts

* Remove outdated OrderedDict comments per Python 3.7, replace with plain dict
2020-01-13 21:55:41 +02:00

1.6 KiB

title
Maintenance

This page documents a couple of points for maintaining the Home Assistant code. Most of the tasks don't need to be performed on a regular base thus the steps, used tools, or details are preserved here.

Source code

Line separator

People are using various operating systems to develop components and platforms for Home Assistant. This could lead to different line endings on file. We prefer LN. Especially Microsoft Windows tools tend to use CRLF.

$ find homeassistant -name "*.py" -exec file {} \; | grep BOM
$ find homeassistant -name "*.py" -exec file {} \; | grep CRLF

To fix the line separator, use dos2unix or sed.

$ dos2unix homeassistant/components/notify/kodi.py

File permissions

Most files don't need to the be executable. 0644 is fine.

Dependencies

A lot of components and platforms depends on third-party Python modules. The dependencies which are stored in the requirements_all.txt files can be tracked with pur or pip-upgrader.

If you update the requirements of a component/platform by updating manifest.json, run the provided script to update the requirements_*.txt file(s).

$ script/gen_requirements_all.py

Start a test run of Home Assistant. If that was successful, include all files in a Pull Request. Add a short summary of the changes, a sample configuration entry, details about the tests you performed to ensure the update works, and other useful information to the description.

Documentation

  • Merge current into next on a regular base.
  • Optimize the images.