Developer documentation

Coding standards

  • Python code must be pep8 conform

  • check your code using pylint

  • do not use tabs! Use four whitespaces instead

  • avoid map, filter or lambda commands

  • use format instead of %

  • avoid very long methods

  • use multiple files for completely different classes

  • try to stay Python2.6 conform

  • import of package files should use the complete path (avoid from)

  • all files must include the Python3 compatible header:

    from __future__ import (print_function,
                            unicode_literals,
                            division)
    
  • new include file features:

    • must be downward compatible
    • must be added to schema files
    • must be documented and there must be a small example
    • must be covered by tests

Pylint

In the top directory

pylint --rcfile devel-utils/pylint.rc jube2

Flake8

In the top directory

flake8 --config devel-utils/flake8 jube2

Another possibility is to copy or link the file to the default search path ~/.config/flake8 to use it globally.

Coverage

To produce a coverage report the coverage packet must be installed. Run

python -m coverage run ./run_all_tests.py
python -m coverage html

in the test directory. The first command creates a coverage report .coverage in the current directory and the second one creates a folder htmlcov with html files visualizing the code coverage by adding colors for covered and uncovered regions of the code. The summary can be viewed in index.html.

You might want to replace python with python2 or python3 respectively to explicitly test different python versions and make sure both versions are still working.

Documentation creation

Inside the docs directory you can use:

>>> make html        #create html docu files
>>> make pdflatex    #create pdf  docu file
>>> make update_help #update jube command line help

Create distribution

Inside the main JUBE directory you can use:

>>> python setup.py sdist

to update the tar.gz file inside the dist directory.

  • Check version before running sdist
  • Store a completely new mayor version inside the tags area of the repository

Python package documentation

Here you will find the Python package documentation of JUBE: Package doku