This section provides various hints for developers intending to contribute towards the HermesPy code base.
In order to minimize the chance of code-regressions with new contributions, HermesPy implements various automated code testing routines. New contributions are required to pass existing tests as well as provide tests for additional features introduced with the contribution.
In order to launch unit tests locally,
python -m unittest discover tests/unit_tests
can be executed from the project’s root directory. This will execute all unit tests located under tests/unit_tests/. Additional tests for the integration of modules and the integrity of configuration files and examples can be found under tests/integration_tests/ and tests/config_tests/, respectively. For asserting the unit test coverage, the Hermes pipeline deploys the coverage tool. It can be executed by running the test script with the coverage command
coverage run tests/test_install tests/unit_tests
from the project’s root directory. The coverage report can be generated by running
coverage report -m --include=hermespy/*
which will generate a list of all code statements not covered by the unit tests. HermesPy is currently achieving a test coverage of 100% and kindly asks all contributors to maintain this level.
HermesPy is written in Python 3.10 and fully type annotated. The type annotations are checked by the mypy tool which can be executed by running by running
from the project’s root directory.
Hermes enforces PEP8 compliant coding style, which can be tested by running flake8
from the repository root. Most compliancy violations can be automatically resolved by running the black preprocessor
black -C hermespy/
from the repository root. Prior to their first execution, both tools must be manually installed in your environment of choice
pip install --upgrade flake8 black
The documentation is generated by Sphinx. It requires some additional dependencies which may be installed from PyPi via
pip install -e ".[documentation]"
Additionally, inheritance diagrams are generated by Graphviz, which has to be installed manually on your system and added to the PATH environment variable. The documentation source files are located under /docssource/, however, most API information should be directly inserted into the source code files and inserted by the autodocs extension. A reference example can be found in /hermespy/simulation/rf_chain/power_amplifier.py. See Power Amplifier Modeling for the rendered results.
Sphinx with serveral extensions is used to generate the documentation. Build the documentation by executing
sphinx-build ./docssource/ ./documentation/
within the project’s root directory. This results in the rendering of a html-based documentation website, located under documentation/. In order to view it locally, open index.html within a web-browser of your choice.