Introducing Python3.8 as a snap

I created a python3.8 snap https://snapcraft.io/python38, it is based on team deadsnakes ppa. My main use case was to create a python 3.8 plugin that I could use in my other snaps, while doing that I ended up publishing python3.8 to the store.

Why Python3.8 ?

The main motivation that prompted me to enable python 3 based snaps was due to a very cool feature that landed in that version of python, which allows for the __pycache__ directories to reside in a separate location from the source. That functionality enabled us to reduce size of one of our snaps from 49MBs to 32MBs in size Post install python bytecompile? because we were generating all pycache files post install.

Caveats

The python build we are using come from a third-party ppa published by unknown members of the community, so it would be cool if Snapcrafters or some team from Canonical had a python3.8 ppa that we could rely on.

The other option is of course to build it from source (that I may consider doing in a few days)

3 Likes

It seems Ubuntu archives now have python3.8 so I updated the snap to be based on that.

I have also added pip to the snap so that it becomes easier to install more python packages

Hey @om26er, thanks for this! I’m looking into using this on CentOS 7, since Python is woefully out of date in EPEL.

When I go to create a venv on CentOS 7.6 after installing, I get an error that it can’t create the virtual environment because ensure-pip isn’t included in the build. Any chance of getting that added? Do you have the source to the snap build somewhere we could contribute? Thanks for your efforts!