Skip to content
Kiri Choi edited this page Sep 14, 2019 · 2 revisions

git settings

For consistent line settings set

git config --global core.autocrlf true

coding guidelines

  • all classes are new style classes, i.e. subclass of object
class MyClass(object):
    pass
  • code has to be python 3 conform, i.e. at least add the following to modules
from __future__ import print_function, division
  • Use camelCase for all variables and classes
  • Classes start with a large letter, instances and functions with a small letter
  • code should adhere to PEP8 (https://www.python.org/dev/peps/pep-0008/)
  • raise Exceptions if something goes wrong, never call sys.exit()
  • do imports on top of the module not within functions. The function imports can be packaged even if the import requirements are not full-filled. But will fail on run-time run the tests after changes!

deprecated methods

To mark things as deprecated raise a DeprecationWarning and mention when it will be removed. This allows people to adapt their code base.

def sedml_to_python(inputstring):
    import warnings
    warnings.warn('Use sedmlToPython instead, will be removed in v1.4',
                  DeprecationWarning, stacklevel=2)
    return sedmlToPython(inputstring)

testing

Read https://github.com/sys-bio/tellurium/tree/master/docs

  • run unittests after implementing/changing something
  • implement tests for new things implemented

documentation

Read https://github.com/sys-bio/tellurium/tree/master/docs

  • if you write a function/class/module it has to be documented (one sentence + description of input and output arguments)
  • use doc strings for documenting