We know that for the Python project, we just need to specify plugin as Python in our snapcraft.yaml to download the python version specified in Snapcraft for the Python project. But for some projects, our developers may need a specific Python version, so how do we implement this functionality? In today's tutorial, we'll introduce a new feature added to Snapcraft 2.27.
 
 
Let's take a look at one of my projects first:
 
Https://github.com/liu-xiao-guo/python-plugin Snapcraft.yaml
 
Name:python36
version: ' 0.1 ' 
summary:this is a simple example not using Python plugin
description: |
  This is a python3 example
grade:stable 
confinement:strict
Apps: python36
  :
    command:helloworld_ In_python
  python-version:
    command:python3--version
parts:
  my-python-app:
    Source:https ://github.com/liu-xiao-guo/python-helloworld.git
    Plugin:python after
    : [python]
  python:
    Source:https://www.python.org/ftp/python/3.6.0/python-3.6.0.tar.xz
    plugin:autotools
    configflags: [-- PREFIX=/USR]
    build-packages: [Libssl-dev]
    Prime:
      --usr/include
 
Here, for our Python project, it specifies the python defined in our project Python part. This Python version is downloaded directly from the Web. 
We can directly package our applications and run our applications: 
 
$ python36
Hello, World
 
Obviously our Python is working properly. We can check our Python version with the command python36.python-version command: 
 
$ python36.python-version 
python 3.6.0
 
It shows the version 3.6 of Python that we are currently running. It's the version we downloaded in Snapcraft.