python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
69 stars 41 forks source link

undeclared dependency on PIL (Pillow) #122

Closed carandraug closed 4 years ago

carandraug commented 4 years ago

The the microscope.testsuite.devices modules is dependent on PIL. This is used by the ImageGenerator class, which is used by the TestCamera, to add numbers to the camera.

We can add PIL to setup.py but I was thinking of maybe trying the import of PIL and simply not number the images if it's missing. Opinions?

mickp commented 4 years ago

I guess image numbering isn't essential, but it can be really useful in diagnosing situations with multiple clients. It could be even more useful if we put it as a testing feature on the base class, so we could annotate an image from any camera - this could really help with diagnosing triggering and lost image problems. Either way, it could be an optional thing that is only available if you've installed PIL; I don't see that causing any problems, provided that we clearly document that PIL is required for the feature.

iandobbie commented 4 years ago

PIL is also now used for the mosaic camera mode, I suggest that we just add it as a dependency.

carandraug commented 4 years ago

PIL is also now used for the mosaic camera mode,

Even when that does get added, it will still be for one feature of the testsuite, and so not a dependency for the vast majority of the users. And PIL is a dependency that requires a compiler, it's not only python code.

However, we already require a compiler because of our dependency on numpy and Pillow is equally common that most people will get pre-built binaries of Pillow anyway.

I have pushed 9a66b121a0f6 which adds Pillow as requirement. Closing as fixed.