Our Python style is largely based on the PEP-8 standard. We have a few specific rules on top of that that we like to enforce.

<aside> ⚠️ Don't rely fully on pycodestyle

The pycodestyle (formerly pep8) tool does not necessarily enforce the right styles in all cases! Despite the name, it's not built solely to test against PEP-8 or our code style. It by default tests against what the author considers best practices, which do not always match our own style guidelines.


Line length

Many statements will require more than one line. For this, we prefer parenthesis for line continuation, rather than backslashes (in most cases — see below).

For example, if statements, for loops, etc. will use parenthesis:

if (some_long_function_call('that might take a whole line') and

For multi-line strings that won't fit on a single line, use parenthesis:

s = ('This is a long string that will take up multiple lines '
     'and require parenthesis.')