Set up an environment

Written for Ubuntu. Windows and macOS work the same way; the paths are noted where they differ.

Install a virtual environment

Use qgis-venv-creator (see this article) through pipx (sudo apt install pipx):

pipx run qgis-venv-creator --venv-name ".venv"

Then enter the virtual environment:

. .venv/bin/activate
# or
source .venv/bin/activate

Or use the system Python with access to the QGIS packages:

# create virtual environment linking to system packages (for pyqgis)
python3 -m venv .venv --system-site-packages
source .venv/bin/activate

Install the development dependencies

# bump dependencies inside venv
python -m pip install -U pip
python -m pip install -U -r requirements/development.txt

# install git hooks (pre-commit)
pre-commit install

A dedicated QGIS profile

We recommend a dedicated QGIS profile for the development of the plugin, to avoid conflicts with other plugins.

  1. From the command line (a terminal with the qgis executable in PATH, or the OSGeo4W Shell):

    # Linux
    qgis --profile plg_geoserver_manager
    # Windows - OSGeo4W Shell
    qgis-ltr --profile plg_geoserver_manager
    # Windows - PowerShell opened in the QGIS installation directory
    PS C:\Program Files\QGIS 3.40.4\LTR\bin> .\qgis-ltr-bin.exe --profile plg_geoserver_manager
    
  2. Then set the QGIS_PLUGINPATH environment variable to the path of the plugin, in the profile preferences:

    QGIS - Add QGIS_PLUGINPATH environment variable in profile settings

  3. Enable the plugin in the plugin manager. Ignore the invalid folders, such as the documentation and the tests:

    QGIS - Enable the plugin in the plugin manager

The plugin is experimental=True, so Show also experimental plugins must be on in the plugin manager. Before you assume the default profile, check which profile QGIS starts: lastProfile in profiles.ini.

A local GeoServer to test against

docker-compose.yml in the repository root starts a throwaway GeoServer and a PostGIS database:

docker compose up -d
docker compose ps          # wait until gsm-geoserver is "healthy"

GeoServer

http://localhost:8080/geoserver, admin / geoserver

Database, as seen from GeoServer

host postgis, port 5432, database / user / password geoserver

Configure the plugin with that URL, user name and password in Settings → Options → GeoServer Manager.

The server includes demo workspaces, stores, layers, styles and layer groups. Use them to exercise the listings, the search, the pagination and the editing of resources.

For the empty first-run state, “no workspaces yet”, which the Add flows and the “create a workspace first” warning are about:

docker compose down -v && SKIP_DEMO_DATA=true docker compose up -d

The -v matters: the demo data is unpacked only when the data-dir volume is created, so flipping the variable on an existing volume changes nothing.

PostGIS is part of the stack on purpose. “PostGIS” is the plugin’s main datastore type. Without a reachable database a created store looks fine but serves nothing, so the interesting edit behaviour cannot be tested. Use the postgis host name, not localhost. GeoServer resolves it on the compose network, which is why the database port is not published to the host.

A PMTiles datastore config can be created against vanilla GeoServer, but serving from one needs the community module; see the commented COMMUNITY_EXTENSIONS lines in docker-compose.yml.

docker compose down -v     # stop and discard both volumes