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.
Dependencies
Follow the instructions above to install PyTorch, Java, and optionally a virtual environment.
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
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``
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 uv sync --extra dev --extra doc --extra torch-cpu
--extra torch-cpuinstalls CPU-only PyTorch wheels, resolved automatically via thepytorch-cpuindex configured inpyproject.toml– no manual--index-urlstep needed. If you have a GPU and want CUDA-enabled PyTorch instead, use--extra torchin place of--extra torch-cpu(the two are mutually exclusive).cd CapyMOA pip install --editable ".[dev,doc,torch]"
The
devextra does not includetorch– add it explicitly (as above) to run the whole test suite. On Linux, install the CPU build of PyTorch first if you do not want the CUDA packages – see the PyTorch note in Setup.Congratulations!
You have successfully installed CapyMOA in editable mode.
A number of utility scripts are defined in
tasks.pyto perform common tasks. You can list all available tasks by running:uv run invoke --list
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. clean.build Clean all build artifacts. clean.docs Remove the built documentation. clean.nb Remove generated notebook artifacts (`.ipynb` files, execution side-effects). docs.build (docs) Build the documentation using Sphinx. docs.clean Remove the built documentation. docs.nb Execute notebooks and bake their outputs into their `.ipynb` files. 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 Execute notebooks and bake their outputs into their `.ipynb` files. test.pytest Run the tests using pytest.Each of these tasks can be run in the terminal through
invoke <task>. If you installed withuv sync(and have not separately activated.venv), prefix every invocation withuv runinstead –uv syncdoes not put.venvonPATHthe way activating it does. Running the task to build documentation would look like this:uv run invoke docs.build
invoke docs.buildSee the Contributing guide for more information on how to contribute to CapyMOA, including how to test PyTorch-optional code in Adding Tests.