qgis_deployment_toolbelt.plugins.plugin module#

Plugin object model.

Author: Julien Moura (https://github.com/guts)

class qgis_deployment_toolbelt.plugins.plugin.QgisPlugin(name: str, folder_name: str = None, location: QgisPluginLocation = 'remote', official_repository: bool = None, plugin_id: int = None, qgis_maximum_version: str = None, qgis_minimum_version: str = None, repository_url_xml: str = None, url: str = None, version: str = 'latest')#

Bases: object

Model describing a QGIS plugin.

ATTR_MAP = {'location': 'type', 'qgis_maximum_version': 'qgisMaximumVersion', 'qgis_minimum_version': 'qgisMinimumVersion'}#
OFFICIAL_REPOSITORY_URL_BASE = 'https://plugins.qgis.org/'#
OFFICIAL_REPOSITORY_XML = 'https://plugins.qgis.org/plugins/plugins.xml'#
property download_url: str#

Try to guess download URL if it’s not set during the object init.

Returns:

download URL

Return type:

str

folder_name: str = None#
classmethod from_dict(input_dict: dict) Self#

Create object from a dictionary.

Parameters:

input_dict (dict) – input dictionary

Returns:

instanciated object

Return type:

Self

classmethod from_plugin_folder(input_plugin_folder: Path) Self#

Create object from a QGIS plugin folder. Must contain a metadata.txt file.

Parameters:

input_plugin_folder (Path) – path to the folder containgin a QGIS plugin

Returns:

instanciated object

Return type:

Self

classmethod from_zip(input_zip_path: Path) Self#

Create object from a ZIP file.

Parameters:

input_zip_path (Path) – filepath of the input zip

Returns:

instanciated object

Return type:

Self

property id_with_version: str#

Unique identifier using plugin_id (if set) and name + version slugified.

Returns:

plugin identifier meant to be unique per version

Return type:

str

property installation_folder_name: str#

Name of the folder when the plugin is installed into QGIS/profile/python/plugins/. If not clearly specified intot the profile.json, it tries to extract it from the download URL. As final fallback, it returns the slufigied plugin name.

Returns:

plugin folder name

Return type:

str

is_older_than(version_to_compare: str | Self) bool#

Determine if the actual object version is older than the given version to compare.

Parameters:

version_to_compare (Union[str, Self]) – given version to compare with object version

Returns:

True if the given version is newer (more recent)

Return type:

bool

location: QgisPluginLocation = 'remote'#
name: str#
official_repository: bool = None#
plugin_id: int = None#
qgis_maximum_version: str = None#
qgis_minimum_version: str = None#
repository_url_xml: str = None#
property uri_to_zip: str#
Get the plugin URI. Can be either a local path or remote URL (in that case

it’s mapped to dowload_url property).

Returns:

URI (path or URL) to the plugin ZIP archive

Return type:

str

url: str = None#
version: str = 'latest'#
class qgis_deployment_toolbelt.plugins.plugin.QgisPluginLocation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

local = 1#
remote = 2#