Python apps

Some misc thoughts with the documentation page on Python apps:

  • The need for there to be a setup.py for Python apps to build under the snapcraft Python plugin intoduces a steep hurdle to adoption IMO.
  • The inability to use different Python versions, other than what is supplied by default in the base is disappointing and has been a limitation for many years, with developers struggling with workarounds e.g. Build a snap with any version of Python I want

and

  • Building the snap example using snapcraft --use-lxd on a fresh install of ubuntu 22.04 server (then upgraded to add desktop) fails. You have to sudo lxd init --auto to get lxd to work properly - worth mentioning somewhere in the doco, even if its not a specifically python issue.

Summary of my experience:

  1. snapcraft with lxd tooling initially failed, had to google workaround
  2. official yt-dlp Python example failed to build, had to google workaround
  3. can’t begin to package my python project without modifying it and learning about setup.py - it would be nice to be able to create a snap for a normal unpackaged Python program, which 99% of python apps are.
  4. can’t use a version of Python that I want - stuck with what is supplied in corexx
  5. the need to specify additional unknown linux packages in a stage-packages: and build-packages: sections e.g. libssl-dev libjpeg-dev libtiff-dev libgtk2.0-0 etc. etc. is a huge blocker. Even when snapcraft reports library names are needed, those names are not usable and one must apt-file search xxx each one to get a name acceptable to snapcraft.
  6. Various intricate workarounds are needed to get wxpython desktop python snaps to build under core20 and core22 - see https://github.com/Unrud/video-downloader/blob/master/snap/snapcraft.yaml and Python Plugin + Gnome 3 Extension Error
  7. The gnome extension does not play well with the python plugin and snaps cannot get into the snapstore see Core22 gnome extension and broken symlinks without manually editing the snap and removing certain files.