napari / cookiecutter-napari-plugin

Cookiecutter for napari plugins
BSD 3-Clause "New" or "Revised" License
67 stars 39 forks source link

pyqt5 is needed in setup.cfg? #108

Closed cnstt closed 2 years ago

cnstt commented 2 years ago

When I wanted to try and test my plugin in a fresh virtualenv, although napari and qtpy were installed through setup.cfg, napari couldn't start because of the lack of pyqt5. So I added it to the setup.cfg so when doing pip install -e . Napari could start! Is this a bug with the cookiecutter plugin or am I doing something wrong?

alisterburt commented 2 years ago

Hi @cnstt, thanks for raising this issue!

This is a deliberate choice, pyqt5 has a license that is restrictive for certain groups of people and they may prefer to use pyside2, an alternative set of python bindings for Qt. We would prefer that plugin authors not depend directly on specific qt bindings for this reason.

A solution for your own plugin would be to add an extras_require section to your setup.cfg file which includes pyqt5. You can then install your package, with the bindings with a command like pip install mypackage[all]

Going to close this, feel free to reopen if you still think this is an issue

tlambert03 commented 2 years ago

See also https://napari.org/plugins/best_practices.html#don-t-include-pyside2-or-pyqt5-in-your-plugin-s-dependencies

cnstt commented 2 years ago

Thanks a lot for your explanations! So in order to test the plugin in a fresh environment I need to additionally install napari with pip install napari[all]