For several BrainGlobe repositories, we have decided to include napari as an optional dependency, so that users can specify tool[napari] when they want to use the napari widgets of that tool, and omit [napari] otherwise.
This is accomplished by adding napari and qtpy as optional dependencies in pyproject.toml, for example:
That said, during the development of napari widgets, we also need pytest-qt, which in turn also requires qtpy and a graphics backend, for example PyQt5. The logical place for these requirements to go is the dev dependencies. This is how I handled it in this PR for brainglobe-utils. brainreg handles the same problem by putting napari[pyqt5] in both the dev and the napari optional dependencies.
However, that creates the following problem. If one does pip install -e .[dev,napari], as would be the case when developing the napari widgets, we constrain the graphical backend to the one specified in the dev dependencies, which is in general considered bad practice by napari.
For several BrainGlobe repositories, we have decided to include
napari
as an optional dependency, so that users can specifytool[napari]
when they want to use the napari widgets of that tool, and omit[napari]
otherwise.This is accomplished by adding
napari
andqtpy
as optional dependencies inpyproject.toml
, for example:That said, during the development of napari widgets, we also need
pytest-qt
, which in turn also requiresqtpy
and a graphics backend, for examplePyQt5
. The logical place for these requirements to go is thedev
dependencies. This is how I handled it in this PR forbrainglobe-utils
.brainreg
handles the same problem by puttingnapari[pyqt5]
in both thedev
and thenapari
optional dependencies.However, that creates the following problem. If one does
pip install -e .[dev,napari]
, as would be the case when developing the napari widgets, we constrain the graphical backend to the one specified in thedev
dependencies, which is in general considered bad practice by napari.