How to handle shared libraries across snaps

Hi

I am building a collection of research/science tools as snaps.

Many of them need the same libraries and in some cases they have a huge amount of dependencies. What is the least storage/space intensive way to build these snaps?

I can think of the following options:

  • several big snaps, each a suite of commonly co-used software from different organisations. least redundant dependencies, huge snaps and possible bloat.
  • Each snap has its own dependencies. Redundant dependencies across snaps, lots of user admin for aliasing snap functions to make them accessible to other snaps.
  • Ask users to install a set of libraries/dependencies and have snaps expect those. Very likely to not work for many people because of conflicts when dependencies are updated for other software.

Something a bit related: I wanted to create a snap with all the common dependencies and have users install that once. After that all the other snaps can access those dependencies. Is that possible? As I understood it, stage-snaps does not do this, it just adds the content of a pre-existing snap to a new snap.

What would be the best way to proceed?

take a look at the content sharing interface:

if you own all involved snaps, snapd will automatically install the default-provider package for you which should then ship all your shared libs.