Skip to content

Developer Guide

Tom Van Mele edited this page Nov 4, 2019 · 6 revisions

This guide provides basic information about setting up a development environment and writing code for the COMPAS framework.

For instructions on how to submit contributions, see Contributions

Installation

  1. clone repo
  2. install from source (dependencies + dev tools)
$ pip install -r requirements-dev.txt

Writing code

Naming conventions

Package structure

Module structure

In general, we use the __all__ variable to explicitly declare a public module API. The if __name__ is "__main__" guard is used to test the examples declared in docstrings. We do three from __future__ imports to provide compatibility with Python 2.7x.

Class modules

We define one class per module. Two blank lines are inserted before and after the class definition.

from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

__all__ = ['MyClass']


class MyClass(object):

    pass


# ==============================================================================
# Main
# ==============================================================================

if __name__ == "__main__":

    import doctest
    doctest.testmod(globs=globals())

Docstrings

Testing

  • We use pytest for writing unit tests

Benchmarking

Clone this wiki locally