Developer Setup#

If you want to make changes to CapyMOA, you should follow these steps to set up an editable installation of CapyMOA, with development and documentation dependencies.

  1. Dependencies

    Follow the instructions above to install PyTorch, Java, and optionally a virtual environment.

  2. Pandoc

    Ensure that you have Pandoc installed on your system. If it’s not installed, you can install it by running the following command on

    sudo apt-get install -y pandoc
    
    sudo brew install pandoc
    

    Follow the instructions on the Pandoc website.

    conda install -c conda-forge pandoc
    
  3. Clone the Repository

    If you want to contribute to CapyMOA, you should clone the repository, install development dependencies, and install CapyMOA in editable mode.

    If you are intending to contribute to CapyMOA, consider making a fork of the repository and cloning your fork instead of the main repository. This way, you can push changes to your fork and create pull requests to the main repository.

    git clone https://github.com/adaptive-machine-learning/CapyMOA.git
    # or clone via the SSH protocol (often preferred if you use SSH keys for git):
    #   ``git clone with git@github.com:adaptive-machine-learning/CapyMOA.git``
    
  4. Install CapyMOA in Editable Mode

    To install CapyMOA in editable mode with development and documentation dependencies, navigate to the root of the repository and run:

    cd CapyMOA
    pip install --editable ".[dev,doc]"
    
  5. Congratulations!

    You have successfully installed CapyMOA in editable mode.

    A number of utility scripts are defined in tasks.py to perform common tasks. You can list all available tasks by running:

    python -m invoke --list # or `invoke --list`
    
    Available tasks:
    
      commit                                     Commit changes using conventional
                                                 commits.
      format (fmt)                               Format the code using ruff.
      lint                                       Lint the code using ruff.
      refresh-moa                                Replace the moa.jar file with the
                                                 appropriate version.
      build.clean                                Clean all build artifacts.
      build.clean-moa                            Remove the moa.jar file.
      build.clean-stubs                          Remove the Java stubs.
      build.download-moa                         Download moa.jar from the web.
      build.stubs                                Build Java stubs using stubgenj.
      docs.build (docs)                          Build the documentation using
                                                 Sphinx.
      docs.clean                                 Remove the built documentation.
      test.all (test)                            Run all the tests.
      test.coverage-clean (test.cov-clean)       Clean coverage data.
      test.coverage-combine (test.cov-combine)   Combine coverage data from
                                                 different sources.
      test.coverage-report (test.cov-report)     Generate coverage report.
      test.doctest                               Run tests defined in docstrings
                                                 using pytest.
      test.nb                                    Run the notebooks and check for
                                                 errors.
      test.pytest                                Run the tests using pytest.
    

    Each of these tasks can be run in the terminal through invoke <task>. Running the task to build documentation would look like this:

    invoke docs.build
    

    See the Contributing guide for more information on how to contribute to CapyMOA.