Skip to main content

Tool for downloading/managing QGIS plugins from CLI.

Project description

QGIS-Plugin-Manager

Tests PyPi version badge PyPI - Downloads PyPI - Python Version

Mainly designed for QGIS Server plugins.

Not tested on Windows.

The CLI API is not stable yet.

Installation

Python 3.6 minimum, you can make a Python venv if needed.

python3 --version
pip3 install qgis-plugin-manager
python3 -m pip install qgis-plugin-manager

Utilisation

cd /path/where/you/have/plugins
# usually
cd /usr/lib/qgis/plugins

It depends where you want to store QGIS plugins. On a server, you can use the variable QGIS_PLUGINPATH according to the documentation if you don't want the default folder.

$ qgis-plugin-manager --help
usage: qgis-plugin-manager [-h] [-v] {init,list,remote,update,upgrade,cache,search,install} ...

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Print the version and exit (default: False)

commands:
  qgis-plugin-manager command

  {init,list,remote,update,upgrade,cache,search,install}
    init                Create the `sources.list` with plugins.qgis.org as remote
    list                List all plugins in the directory
    remote              List all remote server
    update              Update all index files
    upgrade             Upgrade all plugins installed
    cache               Look for a plugin in the cache
    search              Search for plugins
    install             Install a plugin

Init

To create the first sources.list in the directory with at least the default repository https://plugins.qgis.org :

$ qgis-plugin-manager init
$ cat sources.list 
https://plugins.qgis.org/plugins/plugins.xml?qgis=3.19

You can have one or many servers, one on each line.

List

List all plugins installed :

$ qgis-plugin-manager list
QGIS server version 3.19.0
List all plugins in /home/etienne/dev/qgis/server_plugin

------------------------------------------------------------------------------------------------------------------------------------
|  Name            |  Version  | Flags           |  QGIS min  |  QGIS max  |  Author         | Folder owner     | Action ⚠         |
------------------------------------------------------------------------------------------------------------------------------------
|Lizmap            |master     |                 |3.4         |3.99        |3Liz             | root : 0o755     | Unkown version   |
|wfsOutputExtension|1.5.3      |Server           |3.0         |            |3Liz             | etienne : 0o755  |                  |
|QuickOSM          |1.14.0     |Processing       |3.4         |3.99        |Etienne Trimaille| etienne : 0o755  | Upgrade to 1.16.0|
|cadastre          |1.6.2      |Server,Processing|3.0         |3.99        |3liz             | www-data : 0o755 |                  |
|atlasprint        |3.2.2      |Server           |3.10        |            |3Liz             | www-data : 0o755 |                  |
------------------------------------------------------------------------------------------------------------------

Remote

$ qgis-plugin-manager remote
List of remotes :

https://plugins.qgis.org/plugins/plugins.xml?qgis=3.22

$ cat sources.list 
https://plugins.qgis.org/plugins/plugins.xml?qgis=[VERSION]

[VERSION] is a token in the sources.list file to be replaced by the QGIS version, for instance 3.22. If QGIS is upgraded, the XML file will be updated as well.

You don't have to set the TOKEN for all URL :

https://docs.3liz.org/plugins.xml is valid.

Update

To fetch the XML files from each repository :

$ qgis-plugin-manager update
Downloading https://plugins.qgis.org/plugins/plugins.xml?qgis=3.19...
	Ok
$ ls .cache_qgis_plugin_manager/
https-plugins-qgis-org-plugins-plugins-xml-qgis-3-19.xml

Cache

Check if a plugin is available :

$ qgis-plugin-manager cache atlasprint
Plugin atlasprint : v3.2.2 available

Search

Look for plugins according to tags and title :

$ qgis-plugin-manager search dataviz
Data Plotly
QSoccer

Install

Plugins are case-sensitive and might have spaces in its name :

$ qgis-plugin-manager install dataplotly
Plugin dataplotly latest not found.
Do you mean maybe 'Data Plotly' ?
$ qgis-plugin-manager install 'Data Plotly'

Install the latest version :

$ qgis-plugin-manager install QuickOSM
Installation QuickOSM latest
	Ok QuickOSM.1.16.0.zip

or a specific version :

$ qgis-plugin-manager install QuickOSM==1.14.0
Installation QuickOSM 1.14.0
	Ok QuickOSM.1.14.0.zip

Upgrade

Upgrade all plugins installed :

$ qgis-plugin-manager upgrade

Note, like APT, update is needed before to refresh the cache.

Run tests

export PYTHONPATH=/home/etienne/dev/app/qgis-master/share/qgis/python/:/usr/lib/python3/dist-packages/
cd test
python3 -m unittest
flake8

TODO

  • proper exit code
  • API
  • documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qgis-plugin-manager-1.1.0.tar.gz (14.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page