Creating a snap with a bunch of Python scripts

Hello all!

We currently have a git repo containing Python scripts. These have dependencies that aren’t in Ubuntu, so wherever we use them we have to create a virtualenv (from a requirements.txt in the repo). We don’t currently have a setup.py. These scripts do a variety of things and are completely trusted by us, so the snap is going to use classic confinement.

If I use the python plugin, then I get the dependencies installed, but the scripts aren’t:

parts:
  my-project:
    plugin: python
    requirements: requirements.txt
    source: .

If I use a combination of the dump and python projects, then both the dependencies and the scripts are installed, but the scripts don’t use the Python that’s installed in the snap:

parts:
  dependencies:
    # See 'snapcraft plugins'
    plugin: python
    requirements: requirements.txt
  my-project:
    plugin: dump
    source: .

How can I go about getting the scripts somewhere in the snap and getting them to use the Python that’s installed by the snap?

Thanks!

2 Likes