Developer’s Guide

This document describes how to contribute to the napari-imagej source.

If your goal is only to use napari-imagej to call ImageJ ecosystem routines in napari, see this page.

Configuring a Mamba environment for development

napari-imagej requires Java and Python components, and as such we highly recommend contributors use virtual environments to manage their development environment

The first step towards development is installing napari-imagej from source. With Mamba, this is particularly easy.

git clone https://github.com/imagej/napari-imagej
cd napari-imagej
mamba env create -f dev-environment.yml

This virtual environment must then be activated to work on the napari-imagej source:

mamba activate napari-imagej-dev

Testing

napari-imagej uses pytest to automate testing. By installing the developement environment above, pytest will come installed.

To test napari-imagej, simply run:

pytest

Documentation

napari-imagej uses Read the Docs for user-facing documentation. If you make front-end changes to napari-imagej, please describe your changes with the files in the doc folder of the napari-imagej source.

Once you’ve made your changes, run the following:

make docs

This will build the documentation into HTML files locally, stored in the doc/_build/html folder. You can then view the documentation locally by loading doc/_build/html/index.html in the browser of your choice.

Production documentation is available online at https://napari-imagej.readthedocs.io/

Formatting

black, flake8, and isort are used to lint and standardize the napari-imagej source.

To manually format the source, run (MacOS/Linux):

make clean

napari-imagej also includes pre-commit configuration for those who want it. By using pre-commit, staged changes will be formatted before they can be commited to a repository. pre-commit can be set up using:

pre-commit install

Building distribution bundles

You can run the following to bundle napari-imagej (MacOS/Linux):

make dist