Developer Guide#
Setting up the development environment#
Clone the repository and navigate into it:
git clone git@gitlab.npl.co.uk:eco/tools/eomatch.git
cd ./eomatch
Create a new branch for your contributions:
git checkout -b new-branch-name
git push --set-upstream origin new-branch-name
Install the package with the developer optional dependencies:
pip install -e .[dev]
Install the pre-commit hooks:
pre-commit install
Before you push#
Code formatting#
eomatch uses black for code formatting (enforced via a pre-commit hook). To format your code manually:
black .
Type checking#
eomatch uses mypy for static type analysis (ignore_missing_imports = True).
Run it before pushing:
mypy ./eomatch
Linting#
eomatch uses flake8 with a maximum line length of 120:
flake8 --max-line-length=120 ./eomatch
Running tests#
Tests are stored in eomatch/tests/, eomatch/finder/tests/, and
eomatch/enrich/tests/, and use
pytest. Run the full suite with:
pytest
To run a single test file:
pytest eomatch/tests/test_domain.py
To run a single test:
pytest eomatch/tests/test_domain.py::TestMatchup::test_collocation_region
Compiling documentation#
eomatch uses sphinx to build its documentation. After editing the
docs/ source files, verify that everything compiles correctly:
sphinx-build docs docs/_build -b html
Then open docs/_build/index.html in a browser to review the output.
When adding a new public class or function:
List it in
docs/content/user/api.rst(orbackend_documentation.rstfor internal utilities).Add a usage example in the relevant user-guide page.
Make sure every public method has a Sphinx-style docstring with
:param:and:return:entries.