Code style

All projects in the Mopidy organization follows the following code style:

  • Automatically format all code with Black. Use Black’s string normalization, which prefers " quotes over ', unless the string contains ".

  • Follow PEP 8. Run flake8 to check your code against the guidelines.

The strict adherence to Black and flake8 are enforced by our CI setup. Pull requests that do not pass these checks will not be merged.

For more general advise, take a look at PEP 20 for a nice peek into a general mindset useful for Python coding.