Req Automatically install add-on dependencies from PyPI
#1
The biggest pain for me right now when developing add-ons is the packaging of python library dependencies. For any add-on which depends on quite a few external python libraries which are not already packaged for XBMC, the work required to package it for submission in the official repositories quickly adds up to quite a lot.

In order to do this you would have to either:
  • download all the required libraries and drop them in your add-on directory, or
  • package each and every library you depend on in a different XBMC add-on (which requires significantly more work)

Both of these are quite inefficient and require a significant amount of work to prepare the initial submission and to keep the dependencies up-to-date.

Since most add-ons use libraries which are already found in the Python Package Index wouldn't it be possible to let XBMC download and install these dependencies automatically, preferably whit-in a virtualenv for each add-on?
Are there any security considerations which should be taken into consideration?
Would it be feasible to implement this functionality into XBMC?

By having the dependency resolution implemented directly into XBMC and letting the add-on developers only specify their dependencies in a requirements.txt would make our life as add-on developers much easier.

What do you guys think?

Martijn has mentioned that this would be a no-go on most platforms. Would anyone care to explain what are the platforms for which this idea would not be possible and why is that so?
Reply
#2
i really don't see the issue here. it maybe takes 10 minutes to actually create a xbmc python module and request it to be added to repository.
also can not imagine you need a lot of packages for just a single addon.

also XBMC ships it's own python. if you want to add new libs you need to install those inside the xbmc install directory which may not even be possible on some platforms. also the way you install these on windows for example would be just a pain.
so just creating the addon python modules is the most simple way to go and it doesn't require any work on xbmc core code. and in now way we will be adding additional libs to the xbmc install.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
I'm currently working on a Google Music add-on which requires gmusicapi.

In a newly created virtualenv I get:
Code:
pip install gmusicapi && pip freeze

appdirs==1.2.0
decorator==3.4.0
gmusicapi==3.0.0
httplib2==0.8
mock==1.0.1
mutagen==1.22
oauth2client==1.2
proboscis==1.2.5.3
protobuf==2.5.0
python-dateutil==2.1
requests==2.0.1
six==1.4.1
validictory==0.9.1

Maybe I just got unlucky but I suppose that if I start using some other libraries as well things might escalate pretty quickly.

EDIT:
(2013-11-24, 14:21)Martijn Wrote: also XBMC ships it's own python. if you want to add new libs you need to install those inside the xbmc install directory which may not even be possible on some platforms. also the way you install these on windows for example would be just a pain.
so just creating the addon python modules is the most simple way to go and it doesn't require any work on xbmc core code. and in now way we will be adding additional libs to the xbmc install.

Yes, obviously adding additional libs to the xbmc install is not an option. The way I was thinking this might be implemented is by bundling only virtualenv and pip with the base xbmc install and then everytime the user installs a new addon create a new virtualenv for it. Then each addon will be run inside it's own virtualenv which might also solve eventual dependencies hell issues (which I have no idea how are handled right now).
But again, I'm not sure if this would actually be possible (a problem will be when the user does not have the required shared libraries installed needed to build a package from PyPI).

Or maybe you're right and it's just not such a common problem among add-on developers to be worth the trouble.
Reply

Logout Mark Read Team Forum Stats Members Help
Automatically install add-on dependencies from PyPI0