Code Conventions¶
Code Repository¶
Chimera2 uses git for source code management.
Here are a minimal set of commands to get started using git:
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 user.name "Your Name" git config --global user.email you@example.comMake local copy of repository:
git clone ssh://plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/chimera2.gitWork on development branch:
git checkout developUpdate repository to latest version:
git pullAdd current state of file to the repository:
git add "filename(s)"Commit all changes to repository (added files and changes to those added files):
git commit -aCopy local repository changes to master repository:
git pushDiff from previous to current revision of file (ignores additions):
git whatchanged -n 1 -p <file>Diff to previous commit of file:
git diff HEAD^ <file>
Coding Style¶
Python code should follow the Python Style Guide: PEP 8.
Use new-style classes.
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 <http://wiki.python.org/moin/Vim>: 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.