qgis-plugin-manager


Nameqgis-plugin-manager JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://github.com/3liz/qgis-plugin-manager
SummaryTool for downloading/managing QGIS plugins from CLI.
upload_time2023-01-24 14:34:09
maintainer
docs_urlNone
authorÉtienne Trimaille
requires_python>=3.7
license
keywords qgis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # QGIS-Plugin-Manager

[![Tests](https://github.com/3liz/qgis-plugin-manager/actions/workflows/release.yml/badge.svg)](https://github.com/3liz/qgis-plugin-manager/actions/workflows/release.yml)
[![PyPi version badge](https://badgen.net/pypi/v/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)

Mainly designed for QGIS Server plugins, but it works also for desktop.

Not tested on Windows.

The **CLI** API is not stable yet.

## Installation

Python 3.7 **minimum**, you can make a Python venv if needed.
```bash
python3 --version
```

```bash
pip3 install qgis-plugin-manager
python3 -m pip install qgis-plugin-manager
```

## Environment variables

QGIS-Plugin-Manager will take care of following variables :

* `QGIS_PLUGIN_MANAGER_SOURCES_FILE` for storing a path to the `sources.list` otherwise, the current folder will be used.
* `QGIS_PLUGIN_MANAGER_CACHE_DIR` for storing all XML files downloaded otherwise, the current folder will be used `.cache_qgis_plugin_manager`
* `QGIS_PLUGIN_MANAGER_SKIP_SOURCES_FILE`, boolean when we do not need a `sources.list` file, for instance to list plugins only
* `QGIS_PLUGIN_MANAGER_RESTART_FILE`, path where the file must be created if QGIS server needs to be restarted.
  Read [the documentation](README.md#notify-upstream-if-a-restart-is-needed).
* `QGIS_PLUGINPATH` for storing plugins, from [QGIS Server documentation](https://docs.qgis.org/latest/en/docs/server_manual/config.html#environment-variables)
* `PYTHONPATH` for importing QGIS libraries

## Utilisation

**Either** you need to go in the directory where you are storing plugins, **or** you can use the environment variable `QGIS_PLUGINPATH`.
You can read the [documentation](https://docs.qgis.org/3.22/en/docs/server_manual/config.html#environment-variables)
on QGIS Server about this variable.

```bash
cd /path/where/you/have/plugins
# usually on a server
cd /usr/lib/qgis/plugins
# on unix desktop with the default QGIS profile
cd /home/${USER}/.local/share/QGIS/QGIS3/profiles/default/python/plugins
# or
export QGIS_PLUGINPATH=/path/where/you/have/plugins
```

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

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

commands:
  qgis-plugin-manager command

  {init,list,remote,remove,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
    remove              Remove a plugin by its name
    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 :
```bash
$ 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 :

```bash
$ 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 |                  |
------------------------------------------------------------------------------------------------------------------
```

#### Install needed plugins only, mainly on QGIS server

**Important note**, install **only** plugins you need **you**. On QGIS **desktop**, plugins can slow down your computer.
On QGIS **server**, plugins are like **hooks** into QGIS server, they can alter input or output of QGIS server.
They can produce **unexpected** result if you don't know how the plugin works. Please refer to their respective documentation
or the application that needs QGIS server plugins (for instance,
[plugins for Lizmap Web Client](https://docs.lizmap.com/current/en/install/pre_requirements.html#qgis-server-plugins))

### Remote

```bash
$ 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 :

```bash
$ 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 :

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

### Search

Look for plugins according to tags and title :

```bash
$ qgis-plugin-manager search dataviz
Data Plotly
QSoccer
```

### Install

Plugins are case-sensitive and might have spaces in its name :
```bash
$ 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 :
```bash
$ qgis-plugin-manager install QuickOSM
Installation QuickOSM latest
	Ok QuickOSM.1.16.0.zip
```

or a specific version :

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

You can use `--force` or `-f` to force the installation even if the plugin with the same version is already installed.

#### Enable a plugin

On QGIS **server**, there isn't any setting to enable/disable a plugin.

However, on **desktop**, you still need to enable a plugin, the equivalent of the checkbox in the QGIS graphical plugin
manager.

For instance, with the default profile, usually located in :

```bash
/home/${USER}/.local/share/QGIS/QGIS3/profiles/default/QGIS/
```

you need to edit the `QGIS.ini` file with :

```ini
[PythonPlugins]
nameOfThePlugin=true
```

### Upgrade

Upgrade all plugins installed :

```bash
$ qgis-plugin-manager upgrade
```

You can use `--force` or `-f` to force the upgrade for all plugins despite their version.

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

#### Ignore plugins from the upgrade

Some plugins might be installed by hand, without being installed with a remote. This command will try to upgrade
**all valid** plugins found. However, the command will fail because the plugin has been installed without a remote.

It's possible to ignore such plugin by adding a file `ignorePlugins.list`, next to the `sources.list` file,
with a list of **plugin name** on each line. The `upgrade` will not try to upgrade them.

### Remove

It's possible to use `rm -rf folder_dir` but you can also remove by the plugin name.
It will take care of the `QGIS_PLUGINPATH` environment variable.

```bash
$ qgis-plugin-manager remove Quickosm
Plugin name 'Quickosm' not found
Do you mean maybe 'QuickOSM' ?
$ qgis-plugin-manager remove QuickOSM
Plugin QuickOSM removed
Tip : Do not forget to restart QGIS Server to reload plugins 😎
```

### Notify upstream if a restart is needed

When a plugin is installed or removed and if the environment variable `QGIS_PLUGIN_MANAGER_RESTART_FILE` is set,
an empty file will be created or touched. It can notify you if QGIS Server needs to be restarted for instance.

Note that you must manually remove this file.

## Run tests

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/3liz/qgis-plugin-manager",
    "name": "qgis-plugin-manager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "QGIS",
    "author": "\u00c9tienne Trimaille",
    "author_email": "etrimaille@3liz.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/cb/c0c391277f728052533044ce0764d7e03c74b866d5ceffd6b11e8c1a1cd2/qgis-plugin-manager-1.5.0.tar.gz",
    "platform": null,
    "description": "# QGIS-Plugin-Manager\n\n[![Tests](https://github.com/3liz/qgis-plugin-manager/actions/workflows/release.yml/badge.svg)](https://github.com/3liz/qgis-plugin-manager/actions/workflows/release.yml)\n[![PyPi version badge](https://badgen.net/pypi/v/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qgis-plugin-manager)](https://pypi.org/project/qgis-plugin-manager/)\n\nMainly designed for QGIS Server plugins, but it works also for desktop.\n\nNot tested on Windows.\n\nThe **CLI** API is not stable yet.\n\n## Installation\n\nPython 3.7 **minimum**, you can make a Python venv if needed.\n```bash\npython3 --version\n```\n\n```bash\npip3 install qgis-plugin-manager\npython3 -m pip install qgis-plugin-manager\n```\n\n## Environment variables\n\nQGIS-Plugin-Manager will take care of following variables :\n\n* `QGIS_PLUGIN_MANAGER_SOURCES_FILE` for storing a path to the `sources.list` otherwise, the current folder will be used.\n* `QGIS_PLUGIN_MANAGER_CACHE_DIR` for storing all XML files downloaded otherwise, the current folder will be used `.cache_qgis_plugin_manager`\n* `QGIS_PLUGIN_MANAGER_SKIP_SOURCES_FILE`, boolean when we do not need a `sources.list` file, for instance to list plugins only\n* `QGIS_PLUGIN_MANAGER_RESTART_FILE`, path where the file must be created if QGIS server needs to be restarted.\n  Read [the documentation](README.md#notify-upstream-if-a-restart-is-needed).\n* `QGIS_PLUGINPATH` for storing plugins, from [QGIS Server documentation](https://docs.qgis.org/latest/en/docs/server_manual/config.html#environment-variables)\n* `PYTHONPATH` for importing QGIS libraries\n\n## Utilisation\n\n**Either** you need to go in the directory where you are storing plugins, **or** you can use the environment variable `QGIS_PLUGINPATH`.\nYou can read the [documentation](https://docs.qgis.org/3.22/en/docs/server_manual/config.html#environment-variables)\non QGIS Server about this variable.\n\n```bash\ncd /path/where/you/have/plugins\n# usually on a server\ncd /usr/lib/qgis/plugins\n# on unix desktop with the default QGIS profile\ncd /home/${USER}/.local/share/QGIS/QGIS3/profiles/default/python/plugins\n# or\nexport QGIS_PLUGINPATH=/path/where/you/have/plugins\n```\n\n```bash\n$ qgis-plugin-manager --help\nusage: qgis-plugin-manager [-h] [-v] {init,list,remote,remove,update,upgrade,cache,search,install} ...\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n\ncommands:\n  qgis-plugin-manager command\n\n  {init,list,remote,remove,update,upgrade,cache,search,install}\n    init                Create the `sources.list` with plugins.qgis.org as remote\n    list                List all plugins in the directory\n    remote              List all remote server\n    remove              Remove a plugin by its name\n    update              Update all index files\n    upgrade             Upgrade all plugins installed\n    cache               Look for a plugin in the cache\n    search              Search for plugins\n    install             Install a plugin\n```\n\n### Init\n\nTo create the first `sources.list` in the directory with at least the default repository https://plugins.qgis.org :\n```bash\n$ qgis-plugin-manager init\n$ cat sources.list \nhttps://plugins.qgis.org/plugins/plugins.xml?qgis=3.19\n```\n\nYou can have one or many servers, one on each line.\n\n### List\n\nList all plugins installed :\n\n```bash\n$ qgis-plugin-manager list\nQGIS server version 3.19.0\nList all plugins in /home/etienne/dev/qgis/server_plugin\n\n------------------------------------------------------------------------------------------------------------------------------------\n|  Name            |  Version  | Flags           |  QGIS min  |  QGIS max  |  Author         | Folder owner     | Action \u26a0         |\n------------------------------------------------------------------------------------------------------------------------------------\n|Lizmap            |master     |                 |3.4         |3.99        |3Liz             | root : 0o755     | Unkown version   |\n|wfsOutputExtension|1.5.3      |Server           |3.0         |            |3Liz             | etienne : 0o755  |                  |\n|QuickOSM          |1.14.0     |Processing       |3.4         |3.99        |Etienne Trimaille| etienne : 0o755  | Upgrade to 1.16.0|\n|cadastre          |1.6.2      |Server,Processing|3.0         |3.99        |3liz             | www-data : 0o755 |                  |\n|atlasprint        |3.2.2      |Server           |3.10        |            |3Liz             | www-data : 0o755 |                  |\n------------------------------------------------------------------------------------------------------------------\n```\n\n#### Install needed plugins only, mainly on QGIS server\n\n**Important note**, install **only** plugins you need **you**. On QGIS **desktop**, plugins can slow down your computer.\nOn QGIS **server**, plugins are like **hooks** into QGIS server, they can alter input or output of QGIS server.\nThey can produce **unexpected** result if you don't know how the plugin works. Please refer to their respective documentation\nor the application that needs QGIS server plugins (for instance,\n[plugins for Lizmap Web Client](https://docs.lizmap.com/current/en/install/pre_requirements.html#qgis-server-plugins))\n\n### Remote\n\n```bash\n$ qgis-plugin-manager remote\nList of remotes :\n\nhttps://plugins.qgis.org/plugins/plugins.xml?qgis=3.22\n\n$ cat sources.list \nhttps://plugins.qgis.org/plugins/plugins.xml?qgis=[VERSION]\n```\n\n`[VERSION]` is a token in the `sources.list` file to be replaced by the QGIS version, for instance `3.22`.\nIf QGIS is upgraded, the XML file will be updated as well.\n\nYou don't have to set the TOKEN for all URL : \n\n`https://docs.3liz.org/plugins.xml` is valid.\n\n### Update\n\nTo fetch the XML files from each repository :\n\n```bash\n$ qgis-plugin-manager update\nDownloading https://plugins.qgis.org/plugins/plugins.xml?qgis=3.19...\n\tOk\n$ ls .cache_qgis_plugin_manager/\nhttps-plugins-qgis-org-plugins-plugins-xml-qgis-3-19.xml\n```\n\n### Cache\n\nCheck if a plugin is available :\n\n```bash\n$ qgis-plugin-manager cache atlasprint\nPlugin atlasprint : v3.2.2 available\n```\n\n### Search\n\nLook for plugins according to tags and title :\n\n```bash\n$ qgis-plugin-manager search dataviz\nData Plotly\nQSoccer\n```\n\n### Install\n\nPlugins are case-sensitive and might have spaces in its name :\n```bash\n$ qgis-plugin-manager install dataplotly\nPlugin dataplotly latest not found.\nDo you mean maybe 'Data Plotly' ?\n$ qgis-plugin-manager install 'Data Plotly'\n```\n\nInstall the latest version :\n```bash\n$ qgis-plugin-manager install QuickOSM\nInstallation QuickOSM latest\n\tOk QuickOSM.1.16.0.zip\n```\n\nor a specific version :\n\n```bash\n$ qgis-plugin-manager install QuickOSM==1.14.0\nInstallation QuickOSM 1.14.0\n\tOk QuickOSM.1.14.0.zip\n```\n\nYou can use `--force` or `-f` to force the installation even if the plugin with the same version is already installed.\n\n#### Enable a plugin\n\nOn QGIS **server**, there isn't any setting to enable/disable a plugin.\n\nHowever, on **desktop**, you still need to enable a plugin, the equivalent of the checkbox in the QGIS graphical plugin\nmanager.\n\nFor instance, with the default profile, usually located in :\n\n```bash\n/home/${USER}/.local/share/QGIS/QGIS3/profiles/default/QGIS/\n```\n\nyou need to edit the `QGIS.ini` file with :\n\n```ini\n[PythonPlugins]\nnameOfThePlugin=true\n```\n\n### Upgrade\n\nUpgrade all plugins installed :\n\n```bash\n$ qgis-plugin-manager upgrade\n```\n\nYou can use `--force` or `-f` to force the upgrade for all plugins despite their version.\n\n*Note*, like APT, `update` is needed before to refresh the cache.\n\n#### Ignore plugins from the upgrade\n\nSome plugins might be installed by hand, without being installed with a remote. This command will try to upgrade\n**all valid** plugins found. However, the command will fail because the plugin has been installed without a remote.\n\nIt's possible to ignore such plugin by adding a file `ignorePlugins.list`, next to the `sources.list` file,\nwith a list of **plugin name** on each line. The `upgrade` will not try to upgrade them.\n\n### Remove\n\nIt's possible to use `rm -rf folder_dir` but you can also remove by the plugin name.\nIt will take care of the `QGIS_PLUGINPATH` environment variable.\n\n```bash\n$ qgis-plugin-manager remove Quickosm\nPlugin name 'Quickosm' not found\nDo you mean maybe 'QuickOSM' ?\n$ qgis-plugin-manager remove QuickOSM\nPlugin QuickOSM removed\nTip : Do not forget to restart QGIS Server to reload plugins \ud83d\ude0e\n```\n\n### Notify upstream if a restart is needed\n\nWhen a plugin is installed or removed and if the environment variable `QGIS_PLUGIN_MANAGER_RESTART_FILE` is set,\nan empty file will be created or touched. It can notify you if QGIS Server needs to be restarted for instance.\n\nNote that you must manually remove this file.\n\n## Run tests\n\n```bash\nexport PYTHONPATH=/home/etienne/dev/app/qgis-master/share/qgis/python/:/usr/lib/python3/dist-packages/\ncd test\npython3 -m unittest\nflake8\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Tool for downloading/managing QGIS plugins from CLI.",
    "version": "1.5.0",
    "split_keywords": [
        "qgis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1cbc0c391277f728052533044ce0764d7e03c74b866d5ceffd6b11e8c1a1cd2",
                "md5": "6cfa05428b6d553c0b0cca95578d2427",
                "sha256": "abd06df90d228972d526fa0947b492b1c77f3a24786b0acc012f098fc2ae38fe"
            },
            "downloads": -1,
            "filename": "qgis-plugin-manager-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6cfa05428b6d553c0b0cca95578d2427",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 20462,
            "upload_time": "2023-01-24T14:34:09",
            "upload_time_iso_8601": "2023-01-24T14:34:09.718729Z",
            "url": "https://files.pythonhosted.org/packages/d1/cb/c0c391277f728052533044ce0764d7e03c74b866d5ceffd6b11e8c1a1cd2/qgis-plugin-manager-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-24 14:34:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "3liz",
    "github_project": "qgis-plugin-manager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qgis-plugin-manager"
}
        
Elapsed time: 0.03305s