Building a snap on Source or Compiled Binaries

I’m new to snaps and I have a very basic question that I don’t know why I don’t find online.

Are snaps built off of uncompiled code like phyton scripts, or do we compile the application and build the snap to include the entire compiled folder with executables and libraries?

The answer to that question is yes. :slight_smile:

You can basically do it any and all of those ways:

  • use python source in your snap
  • build the binaries for your snap from source as part of the snapcraft-ing process
  • build your binaries separate from the snapcraft-ing process and them dump them in the snap

Basically any way you want to distribute your application* is possible with a snap.

  • caveats obviously apply but it’s incredibly flexible.

Examples:

Python based snap: https://github.com/snapcrafters/pyradio/blob/master/snap/snapcraft.yaml
Many parts from source snap: https://github.com/snapcrafters/gimp/blob/master/snap/snapcraft.yaml
One based on using a debian package: https://github.com/snapcrafters/codium/blob/master/snap/snapcraft.yaml

Thank you. That one question was confusing my dev team as well.

So if we have a single folder with all our complied python app inside locally on the Ubuntu Desktop, how would we snap just that folder as a part to test it? source . ? or

You’re welcome. I’m not a Python expert and you will have to do some base-level snap training with docs and Github examples. You could possibly use the “dump” plugin to just put it in a snap but again, I’m not certain what your specific app will need.