Bundle package with plugin: Pillow?

Posted on
Fri May 03, 2019 3:24 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Bundle package with plugin: Pillow?

My new and upcoming Roon Controller plugin uses the Python package Pillow to handle Album and Artist images.

Is there a recommended Indigo friendly way to bundle this package with the plugin so that the user doesn't have to install it?

Posted on
Fri May 03, 2019 5:38 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Bundle package with plugin: Pillow?

Just copy the library folder from /Library/Python/2.7/site-packages into the plugin wrapper, right next to the plugin.py file. Look at my Twilio plugin for an example.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri May 03, 2019 5:45 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Bundle package with plugin: Pillow?

Hi Joe,
Thanks - I will give that a try now. :)

Posted on
Fri May 03, 2019 9:03 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Bundle package with plugin: Pillow?

That *should* work - except that I believe that the Pillow library contains compiled C code. Assuming you installed it with pip, the source would have been downloaded and then compiled specifically for the architecture that you're running on. I think the only real issue would be if your OS compiled it for 64-bit it won't run on 32-bit versions, and likely with 10.15+ the opposite is true as well.

Again, may not be an issue, and with modules that don't contain compiled C code it's not an issue.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 03, 2019 9:48 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Bundle package with plugin: Pillow?

When I do the documentation, I will add in a note about 64-bit being a requirement, I suppose I could try and work-out how to detect this?

Thanks for the heads-up. :)

Posted on
Fri May 03, 2019 9:52 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Bundle package with plugin: Pillow?

autolog wrote:
When I do the documentation, I will add in a note about 64-bit being a requirement, I suppose I could try and work-out how to detect this?


You can probably use the platform library for that:

https://docs.python.org/2/library/platform.html

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri May 03, 2019 10:32 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Bundle package with plugin: Pillow?

It's also possible to compile the module manually as "fat" (both 32-bit and 64-bit), though it's definitely a non-trivial exercise that requires first figuring out how the compilation of the module itself works, then where to insert the appropriate flags and do the compile yourself.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests