Python style guide
Coding style and best practices for writing Python code for Software Heritage.
As a general rule, follow the Google Python Style Guide.
Target Python 3. Do not care about backward compatibility with Python 2.
As supplement/overrides to the above general rules, follow the additional recommendations below.
pytestas test runner
tests/dir down deep in the module hierarchy, near to the code being tested
whenever possible, follow all the guidelines in Stargirl Flowers’ Python testing style guide
docstrings should produce a nice API documentation when run through Sphinx, in particular:
docstrings should be written in reStructuredText
docstrings should use the Napoleon style (Google variant) to document arguments, return values, etc.
see also: a comprehensive style example
see also: Sphinx gotchas