Code Conventions

Code Repository

ChimeraX uses git for source code management.

Here are a minimal set of commands to get started using git:

  1. Git associates a user name and email address with all check-ins. The defaults are based on your USERNAME and your computer’s hostname. The email address is usually wrong. To explicitly set those values:

    git config --global "Your Name"
    git config --global
  2. Make local copy of repository (currently we only use the develop branch):

    git clone --depth 1 --single-branch --branch develop
  3. To update repository to latest version:

    git pull
  4. Add current state of file to the repository:

    git add "filename(s)"
  5. Commit all changes to repository (added files and changes to those added files):

    git commit -a
  6. Copy local repository changes to master repository:

    git push
  7. Diff from previous to current revision of file (ignores additions):

    git whatchanged -n 1 -p <file>
  8. Diff to previous commit of file:

    git diff HEAD^ <file>

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.

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.