brainglobe / BrainGlobe

General information, resources and dicussions for the BrainGlobe project.
https://brainglobe.info/
10 stars 1 forks source link

How to handle dev tools for optional napari dependency #42

Closed niksirbi closed 1 year ago

niksirbi commented 1 year ago

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:

[project.optional-dependencies]
napari = [
  "napari>=0.4.18",
  "qtpy",
]

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.

adamltyson commented 1 year ago

Decision made to include all dependencies within [dev]. And run either pip install [dev] or pip install [napari] .