Developers Guide

Set-up the development environment

Pip

$ python3 -m venv --prompt venv .venv
$ source .venv/bin/activate
(venv) $ python3 -m pip install -r requirements-dev-txt

Conda

$ conda create -c conda-forge -n bpack \
    --file requirements-dev.txt python=3

Debian/Ubuntu

$ sudo apt install python3-bitstruct python3-bitarray \
    python3-pytest python3-pytest-cov \
    python3-sphinx python3-sphinx-rtd-theme

Testing the code

Basic testing

$ python3 -m pytest

It is also recommended to use the -W=error option.

Advanced testing

Tox is used to run a comprehensive test suite on multiple Python version. I also check formatting, coverage and checks that the documentation builds properly.

$ tox

Test coverage

$ python3 -m pytest --cov --cov-report=html --cov-report=term bpack

Check formatting

$ python3 -m flake8 --statistics --count bpack

Build the documentation

$ make -C docs html

Test code snippets in the documentation

$ make -C docs doctest

Check documentation spelling

$ make -C docs spelling

Update the API documentation

$ rm -rf docs/api
$ sphinx-apidoc --module-first --separate --no-toc \
    --doc-project "bpack API" -o docs/api \
    --templatedir docs/_templates/apidoc \
    bpack bpack/tests