Changes to PEP8
Follow PEP8 with the following exceptions/additions:
- The maximum length of line is set to 120 characters. In PEP8 the limit is 79 characters.
- Trailing whitespaces are not allowed. PEP8 provides a weak recommendation to avoid whitespaces, too. Configure your IDE to strip trailing whitespaces in the entire file on save.
- Usage of tabs is not allowed. If you're porting an existing codebase, replace all tabs with 4 spaces. PEP8 recommends to retain tabs when working with an existing codebase.
- Every text file should contain exactly one empty line at the end.
- Allowed end-of-line character sequence is Unix-style (
\n, LF) only.
Static type checking
Annotate types of all functions, methods, and properties, whether private or public. Enforce type correctness with MyPy using the following (or stricter) settings (example shown is an excerpt from
All public entities should be documented in ReST, unless they are simple enough for their purpose to be evident without explicit documentation. Do not write in prose what can be expressed in the code; for example, avoid specifying type information in the docstrings – there are type annotations for that.
An example that shows the adopted documentation convention is provided below.
Write all new code in Python 3.7.
The recommended IDE for Python development is JetBrains PyCharm.