Install Python plugin in SNAP

I am trying to develop a python plugin in SNAP. I have started with the example given in github at:

How to install it in my SNAP desktop.

1 Like

I got some hints from the existing plugin here:

So, there are some prerequisites,

  1. Oracle JDK version 8 or later
  2. Build tool Maven must be installed (version 3 or later)
    ** First install java jdk and set PATH environment: https://javatutorial.net/set-java-home-windows-10
    **Then follow configuring Maven: http://maven.apache.org/install.html

Now, Download or clone git repository files.
From windows cmd go to that directory, and build the plugin nbm with cmd using:

> mvn package

Then How to install and run the processor as SNAP plugin see:

Hi,
I hope that will helpful

The python plugin
The python plugin can be used by either Python 2 or Python 3 based parts using one of the following:

a requirements.txt file used to import Python modules
a setup.py script for building the project
packages installed directly from pip
This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.

Plugin-specific features and syntax are dependent on which base is being used, as outlined below:

base: core20
base: core18 | core
See Python applications for a simple example, or search GitHub for projects already using the plugin.

base: core20
This plugin uses the following plugin-specific keywords:

requirements (array)
List of paths to requirements.txt file(s)
constraints (string)
Path to a constraints file.
python-packages (list)
A list of dependencies to install using pip. This supports the same syntax as the pip install command.
This plugin also interprets these specific build-environment entries:

SNAPCRAFT_PYTHON_INTERPRETER
(default: python3)
The interpreter binary to search for in PATH.

SNAPCRAFT_PYTHON_VENV_ARGS
Additional arguments for venv.

By default, this plugin uses Python from the base snap. If a part using this plugin uses a build-base other than that of the base, or a different interpreter is desired, it must be bundled in the snap (including venv) and must be in PATH.

It is required to bundle python when creating a snap that uses classic confinement, this can be accomplished on Ubuntu by adding stage-packages (i.e.; python3-venv).

Use of python3- in stage-packages will force the inclusion of the python interpreter.

Requires Snapcraft version 4.0+.

base: core18 | core
This plugin uses the following plugin-specific keywords:

requirements (array)
List of paths to requirements.txt file(s)

constraints (string)
Path to a constraints file

process-dependency-links (bool; default: false)
Enable the processing of dependency links in pip, which allow one
project to provide places to look for another project

python-packages (list)
A list of dependencies to install using pip. This supports the same syntax as the pip install command. For example:

python-packages:

python-version (string; default: python3)
The python version to use. Valid options are python2 and python3

The python plugin also searches /usr/bin/ for a Python interpreter with a basename matching python-version in the directory. If detected, this takes preference and stage-packages will not use its own interpreter.

If want to learn deep about advance python and its plugin then visit : https://www.cetpainfotech.com/technology/python-training

Hi,

Below are my answer related to your python query -

The python module

The python module can be utilized by either Python 2 or Python 3 based parts utilizing one of the accompanying:

a requirements.txt record used to import Python modules

a setup.py content for building the venture

bundles introduced straightforwardly from pip

This module utilizes the basic module watchwords just as those for “sources”. For more data, see Snapcraft parts metadata.

Module explicit highlights and punctuation are subject to which base is being utilized, as laid out underneath:

base: core20

base: core18 | center

See Python applications for a basic model, or quest GitHub for projects previously utilizing the module.

base: core20

This module utilizes the accompanying module explicit catchphrases:

necessities (exhibit)

Rundown of ways to requirements.txt file(s)

limitations (string)

Way to a limitations record.

python-bundles (list)

A rundown of conditions to introduce utilizing pip. This backings a similar grammar as the pip introduce order.

This module likewise deciphers these particular form climate passages:

SNAPCRAFT_PYTHON_INTERPRETER

(default: python3)

The mediator paired to look for in PATH.

SNAPCRAFT_PYTHON_VENV_ARGS

Extra contentions for venv.

Of course, this module utilizes Python from the base snap. On the off chance that a section utilizing this module utilizes a form base other than that of the base, or an alternate translator is wanted, it should be packaged in the snap (counting venv) and should be in PATH.

It is needed to package python while making a snap that utilizes exemplary constrainment, this can be refined on Ubuntu by adding stage-bundles (i.e.; python3-venv).

Utilization of python3-in stage-bundles will constrain the incorporation of the python mediator.

Requires Snapcraft rendition 4.0+.

base: core18 | center

This module utilizes the accompanying module explicit watchwords:

prerequisites (cluster)

Rundown of ways to requirements.txt file(s)

requirements (string)

Way to a requirements record

measure reliance joins (bool; default: bogus)

Empower the preparing of reliance joins in pip, which permit one

venture to give spots to look to another task

python-bundles (list)

A rundown of conditions to introduce utilizing pip. This backings a similar language structure as the pip introduce order.

Thanks, it works for me. Python plugin is successfully installed in SNAP.