Skip to content

Latest commit

 

History

History
78 lines (51 loc) · 1.76 KB

CONTRIBUTING.md

File metadata and controls

78 lines (51 loc) · 1.76 KB

CONTRIBUTION GUIDE

Project structure

The project structure is based on Kenneth Reitz recommendation.

https://docs.python-guide.org/writing/structure/#structure-of-the-repository

Development environment

Create conda env as explain in README.md

Additional dependencies

conda install -n karios -c conda-forge --file requirements_dev.txt

It installs:

  • bandit: Bandit is a tool for finding common security issues in Python code
  • isort : sort import
  • black: format code
  • pylint: code linter
  • pytest-cov: pytest with code coverage support
  • pycodestyle: check docstring
  • pre-commit: pre commit hook engine : https://pre-commit.com/

Deploy pre-commit hook

pre-commit creates and install git pre commit hook configured thanks to .pre-commit-config.yaml

You MUST deploy pre-commit !

pre-commit install && pre-commit install --hook-type pre-push

Try it

pre-commit run

Best Practices

Format the code

Please, format the code before commit by using the following command :

isort --profile black . && black -l 100 .

As an alternative, you can configure your IDE to let it do it for you.

Use linter to check code quality:

PYTHONPATH=karios pylint karios/

Run tests

Test Data

  • Retrieve test data here,
  • Create a folder /data/KARIOS/
  • Extract test data archive in the folder /data/KARIOS/

Run tests before push:

PYTHONPATH=karios \
    pytest -s --cov=karios --cov-report html:cov_html tests; \
    python -c 'import webbrowser; webbrowser.open_new_tab("./cov_html/index.html")'

For reports options take a look at this : https://pytest-cov.readthedocs.io/en/latest/reporting.html