Development

Install for Development

First off, thanks for taking the time to contribute!

This small guideline may help taking the first steps.

Happy hacking :)

Fork the Repository

Clone nutree to a local folder and checkout the branch you want to work on:

$ git clone git@github.com:mar10/nutree.git
$ cd nutree
$ git checkout my_branch

Work in a Virtual Environment

Install Python

We need Python 3, and pipenv on our system.

If you want to run tests on all supported platforms, install all Python versions in parallel.

Create and Activate the Virtual Environment

Install dependencies for debugging:

$ cd /path/to/nutree
$ pipenv shell
(nutree) $ pipenv install --dev
(nutree) $

The development requirements already contain the nutree source folder, so pipenv install -e . is not required.

The test suite should run

$ tox

Build Sphinx documentation to target: <nutree>/docs/sphinx-build/index.html)

$ tox -e docs

Run Tests

Run all tests with coverage report. Results are written to <nutree>/htmlcov/index.html:

$ tox

Run selective tests:

$ tox -e py312
$ tox -e py312 -- -k test_core

Run Benchmarks

Benchmarks are unit tests that execute small variants of code and measure the elapsed time. See here for some examples.

Since this takes some time, benchmarks are not run with the default test suite, but has to be enabled like so:

$ tox -e benchmarks

Code

The tests also check for eslint, flake8, black, and isort standards.

Format code using the editor’s formatting options or like so:

$ tox -e format

Note

Follow the Style Guide, basically PEP 8.

Failing tests or not follwing PEP 8 will break builds on GitHub, so run $ tox and $ tox -e format frequently and before you commit!

Create a Pull Request

Todo

TODO