Dependency Management for Libraries

At the moment I am working on a new library for Processing which is based on OpenCV. The binary files of OpenCV are about ~400 MB, with all contribution libraries, we are talking about ~700 MB to download. As this maybe won’t be the only library containing the OpenCV binaries, it would make sense for me to at least depend on Gregs already existing OpenCV lib (even it’s a bit outdated).

Of course there are other scenarios, where it would make sense to use already contributed libraries and build on them. For the Processing user it should be a no-brainer to download them and all the necessary dependencies (inside the contribution manager).

While searching through the forum and github, it seems that the need for dependency management is there, but was always to complex to implement:

So I would like to propose a very limited, but simple solution that could be implemented quite fast:

We just use the library.properties file and add a new line to it, which tells the contribution manager, on which libraries this library is based. The contribution manager then just goes through the list, downloads each library (and of course their dependencies) and installs them. This is the most tricky part, because we have to create a dependency graph and remove cycles, but that should be solvable (because there is no version locking atm).

name=Intel RealSense for Processing
category=Hardware
authors=The Author
url=https://github.com/cansik/realsense-processing
sentence=Intel RealSense support for Processing
paragraph=Use the Intel RealSense (https://realsense.intel.com/) cameras together with Processing.
version=212000
prettyVersion=2.1.2
minRevision=0
maxRevision=0

# dependencies (PeasyCam, oscP5)
dependencies=17,118

The library id is assigned by the Contribution Manager manager. You can find the current list here:
http://download.processing.org/contribs/

It would be just a very simple tool, but could be really helpful. Most of my libraries use PeasyCam, oscP5 or some other really basic library. Letting the user to always download them himself is a bit cumbersome and not really “beginner friendly”.

Of course I know, that this won’t solve all our problems and it is not a fully fledged dependency management for Processing. It’s just one step into that direction.

Would be great to here what other library developers think about this idea.

1 Like

This seems like a great idea to me.

I think that a dependency should also have required min version and optional max version. If you want to punt on them, you can use “0” for no min and no max.

# dependencies (PeasyCam, oscP5)
dependencies=17.198.0, 118.0.0

Here we need PeasyCam version 198 or higher, and any old oscP5. The number is the version integer, not the prettyVersion string

This way if we get breaking information on dependency incompatibility then the dependency version range numbers can be updated – and the library installer could give a helpful warning at install time about peasyCam being missing / lower than #a / higher than #b. Even if those features aren’t implemented, they could be in the future.

1 Like

A recent related discussion regarding similar issues with Box2D rather than OpenCV:

1 Like