Developer Documentation#

Installation for developers#

For developers, you can install it in develop mode with the following commands :

git clone https://github.com/brainets/hoi.git
cd hoi
pip install -e .['full']

The full installation of HOI includes additional packages to test the software and build the documentation :

  • pytest

  • pytest-cov

  • codecov

  • pandas

  • xarray

  • sphinx!=4.1.0

  • sphinx-gallery

  • sphinx-book-theme

  • sphinxcontrib-bibtex

  • numpydoc

  • matplotlib

  • flake8

  • pep8-naming

  • black

Contributing to HOI#

Contributing code using pull requests#

We do all of our development using git, so basic knowledge is assumed.

Follow these steps to contribute code:

  1. Fork the hoi repository by clicking the Fork button on the repository page

  2. Install Python >= 3.8

  3. Clone the hoi repository to your computer and install hoi :

git clone https://github.com/YOUR_USERNAME/hoi
cd hoi
pip install -e .['full']
  1. Add the HOI repo as an upstream remote, so you can use it to sync your changes.

git remote add upstream https://github.com/brainets/hoi
  1. Create a branch where you will develop from and implement your changes using your favorite editor :

git checkout -b branch_name
  1. Make sure your code passes HOI’s lint and type checks, by running the following from the top of the repository:

black hoi/
  1. Make sure the tests pass by running the following command from the top of the repository:

pytest -v

Each python file inside HOI is tested to ensure that functionalities of HOI are maintained with each commit. If you modify a file, or example hoi/core/entropies.py, you can run the tests for this specific file only located in hoi/core/tests/tests_entropies.py If you want to only test the files you modified you can use :

pytest -v hoi/path_to_test_file
  1. Once you are satisfied with your change, create a commit as follows :

git add file1.py file2.py ...
git commit -m "Your commit message"

Then sync your code with the main repo:

git fetch upstream
git rebase upstream/main

Finally, push your commit on your development branch and create a remote branch in your fork that you can use to create a pull request from:

git push --set-upstream origin branch_name

Please ensure your contribution is a single commit

  1. Create a Pull request. To this end, in your web browser go to your hoi repository and you should see a message proposing to draft a pull request.