Development
===========

Getting the source
------------------

The source can be obtained via mercurial from
https://bitbucket.org/gocept/nagiosplugin::

   hg clone https://bitbucket.org/gocept/nagiosplugin

This package supports installation in a virtualenv using zc.buildout.


Creating a build with zc.buildout
---------------------------------

First, create a virtualenv if not already present::

   virtualenv -p python3.2 .

If you want to use Python 2.7, specify this Python version while creating the
virtualenv::

   virtualenv -p python2.7 .

Sometimes, you will run into strange setuptools/distribute version conflicts.
The best way around is to keep setuptools and distribute entirely out of the
virtualenv::

   virtualenv -p python3.2 --no-setuptools .

`bootstrap.py` and zc.buildout will take care of all required dependencies.

Then launch the usual buildout steps::

   bin/python3.2 bootstrap.py
   bin/buildout


Tests
-----

When the buildout succeeds, run the unit test by invoking::

   bin/test

Our `build server`_ runs test against the trunk on a regular basis.

.. image:: https://builds.gocept.com/job/nagiosplugin/badge/icon
   :target: https://builds.gocept.com/job/nagiosplugin/
.. _build server: https://builds.gocept.com/job/nagiosplugin/

nagiosplugin also includes support for coverage reports. It aims at 100% test
coverage where possible. The preferred way to get a coverate report is to use ::

   bin/createcoverage

to determine test coverage and open the report in a web browser. Alternatively,
run ::

   bin/coverage run bin/test

to get a purely text-based coverage report.

You may run the supplied examples with the local interpreter::

   bin/py src/nagiosplugin/examples/check_load.py


Documentation
-------------

The documentation uses Sphinx. Build the documentation (buildout should have
been running before to install Sphinx etc.)::

   make -C doc html


How to release
--------------

To make a release, we prefer `zest.releaser`_. To make a release, follow
the standard procedure, which usually boils down to::

   fullrelease

`nagiosplugin` tried to obey the semantic version numbering specification
published on SemVer_ but adapts it a little bit to be `PEP 386`_ compliant.

.. _zest.releaser: http://pypi.python.org/pypi/zest.releaser/
.. _SemVer: http://semver.org/
.. _PEP 386: http://www.python.org/dev/peps/pep-0386/

.. vim: set ft=rst sw=3 sts=3 et:
