How to contribute?¶
Some recommended packages for Python development¶
pytest: Run
pytest
in the main folder of the repository to run alltest_*.py
filespylint: Scan your code for naming conventions and proper use of Python
rope: Python refactoring tools
sphinx: Generate documentation of your Python package
doc8: A style checker for reStructuredText
These packages and more can be installed using the requirements-dev.txt file:
pip install -r requirements_dev.txt
Conventions¶
Try to keep test coverage high. You can test current coverage by running
cd tests
pytest
Note that we navigated into the tests directory first as
to avoid testing the files in the source code directory. You can view the coverage report by opening
htmlcov/index.html
.
Git¶
Please use conventional commit messages: start the commit with a semantic keyword (see e.g. Angular or these examples, followed by a column, then the message. The message itself should be in imperative mood — just imagine the commit to give a command to the code framework. So for instance:
feat: add coverage report tools
orfix: remove ...
.In the master branch, each commit should compile and be tested. In your own branches, it is recommended to commit frequently (WIP keyword), but squash those commits upon submitting a merge request.
Python¶
Follow PEP 8 conventions.
Any Python file that’s part of a module should contain (in this order):
1. A docstring describing what the file contains and does, followed by two empty lines.
When calling or defining multiple arguments of a function and multiple entries in a data container, split the entries over multiple lines and end the last entry with a comma, like so:
This is to facilitate eventual diff comparisons in Git.