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`_.

.. _zc.buildout: https://pypi.python.org/pypi/zc.buildout


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

First, create a virtualenv if not already present::

   virtualenv -p python3.4 --no-setuptools .

zc.buildout will take care of all required dependencies::

   bin/pip3.2 install -U zc.buildout
   bin/buildout

If you want to use another Python version like 2.7, just the same steps with the
Python version substituted::

   virtualenv -p python2.7 --no-setuptools .
   bin/pip2.7 install -U zc.buildout
   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.flyingcircus.io/job/nagiosplugin/PYTHON=System-CPython-2.7/badge/icon
   :target: https://builds.flyingcircus.io/job/nagiosplugin/
.. _build server: https://builds.flyingcircus.io/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: https://pypi.python.org/pypi/zest.releaser/
.. _SemVer: http://semver.org/
.. _PEP 386: https://www.python.org/dev/peps/pep-0386/

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