Skip to content

Latest commit

 

History

History
128 lines (99 loc) · 5.52 KB

CONTRIBUTING.md

File metadata and controls

128 lines (99 loc) · 5.52 KB

Contributing

🎉🥂 First off, thanks for taking the time to contribute! 🎉🥂

Contributions are always welcome, no matter how small.

The following is a small set of guidelines for how to contribute to the project

Where to start

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating you are expected to adhere to these expectations. Please report unacceptable behavior to [email protected]

Contributing on Github

If you're new to Git and want to learn how to fork this repo, make your own additions, and include those additions in the master version of this project, check out this great tutorial.

Community

This project is maintained by the NeuroTechX community. Join the Gitter, where discussions about MOABB takes place.

How can I contribute?

If there's a feature you'd be interested in building or you find a bug or have a suggestion on how to improve the project, go ahead! Let us know on the Gitter or open an issue so others can follow along and we'll support you as much as we can. When you're finished submit a pull request to the master branch referencing the specific issue you addressed.

Steps to Contribute

  1. Look for open issues or open one
  2. Discuss the problem and or propose a solution
  3. Fork it! (and clone fork locally)
  4. Branch from develop: git checkout --track develop
  5. Setup development environment
  6. Create your feature branch: git checkout -b my-new-feature
  7. Make changes
  8. Commit your changes: git commit -m 'Add some feature'
  9. Don't forget to fix issues from pre-commit pipeline (either add changes made by hooks or fix them manually in case of flake8)
  10. Push to the branch: git push origin my-new-feature
  11. Submit a pull request. Make sure it is based on the develop branch when submitting! :D
  12. Don't forget to update the what's new and documentation pages if needed

Setup development environment

  1. install poetry (only once per machine):
    curl -sSL https://install.python-poetry.org | python3 -
    or checkout installation instruction or use conda forge version
  2. (Optional, skip if not sure) Disable automatic environment creation:
    poetry config virtualenvs.create false
  3. (Optional) Install the optional dependency
  4. install all dependencies in one command (have to be run in thibe project directory):
    poetry install
  5. install pre-commit hooks to git repo:
    pre-commit install
  6. you are ready to code!

Note 1:
Your first commit will trigger pre-commit to download Code Quality tools. That's OK and it is intended behavior. This will be done once per machine automatically.

Note 2:
By default poetry creates separate Python virtual environment for every project (more details in documentation). If you use conda or any other way to manage different environments by hand - you need to disable poetry environment creation. Also in this case be careful with version of Python in your environment - it has to satisfy requirements stated in pyproject.toml. In case you disable poetry you are in charge of this.

Note 3 (deep learning):
In case you want to install the optional deep learning dependencies (i.e. poetry install --with deeplearning), you will need to do the following additional steps if you want tensorflow to detect your GPU:

# Instructions for tensorflow==2.12
conda install -c conda-forge cudatoolkit=11.8.0
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
# Verify install:
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Then, at every use, re-run the command source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh (you can simply add this line to your .bashrc). For more details, please refer to the official documentation.

Tools used

MOABB uses poetry for dependency management. This tool enables one to have a reproducible environment on all popular OS (Linux, MacOS and Windows) and provides easy publishing pipeline.

Another tool that makes development more stable is pre-commit. It automatically runs variety of Code Quality instruments against the code you produced.

For Code Quality verification, we use:

  • black - Python code formatting
  • isort - imports sorting and grouping
  • flake8 - code style checking
  • prettier - .yml and .md files formatting

Generate the documentation

To generate a local version of the documentation:

cd docs
make html