Developing Dectate¶
Install Dectate for development¶
First make sure you have virtualenv installed for Python 3.5.
Now create a new virtualenv somewhere for Dectate’s development:
$ virtualenv /path/to/ve_dectate
The goal of this is to isolate you from any globally installed versions of setuptools, which may be incompatible with the requirements of the buildout tool. You should also be able to recycle an existing virtualenv, but this method guarantees a clean one.
Clone Dectate from github (https://github.com/morepath/dectate) and go to the dectate directory:
$ git clone git@github.com:morepath/dectate.git
$ cd dectate
Now we need to run bootstrap-buildout.py
to set up buildout, using
the Python from the virtualenv we’ve created before:
$ /path/to/ve_dectate/bin/python bootstrap-buildout.py
This installs buildout, which can now set up the rest of the development environment:
$ bin/buildout
This will download and install various dependencies and tools.
Running the tests¶
You can run the tests using py.test. Buildout will have installed
it for you in the bin
subdirectory of your project:
$ bin/py.test dectate
To generate test coverage information as HTML do:
$ bin/py.test --cov dectate --cov-report html
You can then point your web browser to the htmlcov/index.html
file
in the project directory and click on modules to see detailed coverage
information.
Running the documentation tests¶
The documentation contains code. To check these code snippets, you can run this code using this command:
$ bin/sphinxpython bin/sphinx-build -b doctest doc out
Building the HTML documentation¶
To build the HTML documentation (output in doc/build/html
), run:
$ bin/sphinxbuilder
Various checking tools¶
The buildout will also have installed flake8, which is a tool that can do various checks for common Python mistakes using pyflakes, check for PEP8 style compliance and can do cyclomatic complexity checking. To do pyflakes and pep8 checking do:
$ bin/flake8 dectate
To also show cyclomatic complexity, use this command:
$ bin/flake8 --max-complexity=10 dectate