Python Coding Conventions

This page tentatively introduces the NWX team’s coding conventions for writing Python.

Code Formatting

When possible, yapf (PyPI link) will be used to enforce code conventions. In general, Python code should be PEP 8 compliant.

Docstrings

A general description of a docstring and standardized conventions are described in PEP 257. Docstrings in NWChemEx are written using the Sphinx format, described here.

Docstrings should be used to sufficiently document Python modules, classes, and functions, similar to the expectation that C++ code be documented sufficiently through Doxygen documentation blocks.

Note

For IDE tools to help with these conventions, see Using IDEs to Develop NWX.