Skip to content

Latest commit

 

History

History
113 lines (79 loc) · 2.14 KB

File metadata and controls

113 lines (79 loc) · 2.14 KB

Contributing to Nxslib

Recommended tools

We use tox to automate tedious developer tasks, thus installing it is highly recommended.

pip install --user tox

Setting up for development

  1. Clone the Nxslib repository.
git clone https://github.com/railab/nxslib.git
cd nxslib
  1. Create and activate a virtual environment
virtualenv venv
source venv/bin/activate
  1. Install Nxslib in editable mode

pip install -e .

Code style and running tests

Docstring Format

This project uses Sphinx-style docstrings exclusively. Do not use Google-style or NumPy-style docstrings.

Correct (Sphinx style):

def example_function(param1, param2):
    """Brief description of function.

    Longer description if needed.

    :param param1: description of param1
    :param param2: description of param2
    :return: description of return value
    :raises ValueError: description of when this is raised
    """

Incorrect (Google style) - DO NOT USE:

def example_function(param1, param2):
    """Brief description of function.

    Args:
        param1: description of param1
        param2: description of param2

    Returns:
        description of return value
    """

Code Formatting

Code formatting is ensured by black and isort. To reformat your changes, use:

tox -e format

Untyped function definitions are disallowed (mypy --strict). Type checking can be run with:

tox -e type

Flake8 linter is available with:

tox -e flake8

CI requires 100% coverage to pass. If some of your changes can't be easily tested, you can exclude code from coverage with a #pragma: no cover comment. To run tests with coverage report run:

tox -e py

If you don't care about coverage report or want to run tests in parallel, just use:

tox -e test

Currently the pylint report isn't taken into account to pass CI (in the future it may change), but it's available from tox:

tox -e pylint

CI

Please run tox before submitting a patch to be sure your changes will pass CI.