Contributing

We appreciate all forms of help and contributions, including but not limited to

  • Star and watch our project

  • Open an issue for any bugs you find or features you want to add to our library

  • Fork our project and submit a pull request with your valuable codes

Note

We have some TODOs listed in the Roadmap that we need help with.


To Implement New Features

Note

Please submit all pull requests to the dev branch instead of the main branch

Before Implementation

Please read the API Cheatsheet and API Reference for the API of our implemented classes and the abstract methods that need to be implemented when creating a new algorithm/partition/objective/node.

During Implementation

Please carefully follow our API and the Usage Examples. For example, every algorithm needs to inherit the class PyXAB.algos.Algo.Algorithm, and has to implement the abstract methods PyXAB.algos.Algo.Algorithm.pull(), PyXAB.algos.Algo.Algorithm.receive_reward() and PyXAB.algos.Algo.Algorithm.get_last_point().

Documentations

We do not ask for detailed documentations, but if it is possible, please add some comments and documentations for your implemented functions/classes, following the numpy docstring style.

Testing and Debug

After implementation, please test your algorithm by running it on some of our synthetic objectives for debugging and improvements and write a test_xxx.py file.

Final Check

Before submitting the pull request, please make sure you have the following files ready

xxx.py
test_xxx.py

Optional Steps

Note

The following steps are optional but highly recommended

Black CodeStyle

In PyXAB, we follow the black codestyle. See more details on webpage of black and our issue. To convert your code, simply follow the instructions below.

First, run the following lines of code to install black

python -m pip install --upgrade pip
python -m pip install black

After implementing your own classes with documentations, run the following lines to change your code style

black PyXAB
python -m black PyXAB #if the above line does not work

Local Testing and Coverage

First, run the following lines of code to install pytest and coverage

python -m pip install --upgrade pip
python -m pip install pytest==7.1.2
python -m pip install coverage

To obtain the testing results and the code coverage report, run the following lines

coverage run --source=PyXAB -m pytest
coverage report

To see which lines are not covered by the tests, run the following lines

coverage run --source=PyXAB -m pytest
coverage report -m