Code Conventions

Coding Style

ChimeraX uses Python 3.

Python code should follow the Python Style Guide: PEP 8.

Documentation Strings should follow Python’s documentation style given in Chapter 7 of the Python Developer’s Guide. So use reStructuredText (reST) as extended by Sphinx.

The docstrings of MainToolWindow and MainToolWindow.create_child_window() can serve as reference docstrings. Specifying an argument’s type is not necessary; if PEP 484 style type hints are used, Sphinx (through the spinx_autodoc_typehints extension) will pick them up automatically.

Editor defaults

From <>: All python files should have the following modeline at the top:

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4:

But modelines are a security risk, so put:

au FileType python setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4

in your .vimrc as well.