QDT 0.44: clean up stale QGIS resources

As part of QGIS deployment stakes, a recurring scenario has emerged:

  1. A QGIS profile is deployed via QDT with a set of plugins.
  2. A few weeks or months later, the profile evolves: the end-user added other plugins, some plugins are no longer needed, others are replaced by new versions, and the cache of old plugins accumulates.

Across several hundred workstations, it becomes difficult to know which plugins are still “managed” by QDT, which ones can be safely removed, and how to avoid breaking user environments.

Until now, great caution was exercised around any local file deletion operation performed by QDT, for fear of removing something important or rendering a profile unusable.

What’s new in QDT 0.44.0

With version 0.44.0 of QGIS Deployment Toolbelt (mainly funded by the Métropole du Grand Lyon), two major improvements make this kind of cleanup much safer and more transparent.

1. “Send to trash” instead of permanent deletion

Thanks to the send2trash package, QDT can now move files to the system Recycle Bin / Trash instead of deleting them outright.
This is significantly less destructive and risky.

The deletion strategy is configurable:

3 options are available:

  • trash_only: attempts to move the file/folder to the system Trash; on failure, only logs the event.
  • trash_or_delete (default): attempts to move to Trash; if that fails, permanently deletes the file.
  • force_delete: direct permanent deletion (previous default behavior).

In a plugin cleanup scenario, using trash_or_delete allows:

  • Protecting users in case of trash-related issues (the file is still deleted).
  • Keeping a safety net: if the trash works, files remain recoverable for some time.

2. JSON manifest of QDT-managed plugins

To remove any ambiguity about what can be deleted, the Plugins Synchronizer job now writes a JSON file in each QGIS profile, in python/plugins/.qdt-managed-plugins.json.

Example (excerpt from the “QDT Viewer Mode” demo profile):

{
  "QuickOSM": {
    "installed_at": "2026-07-28T13:55:27.318446+00:00",
    "plg_id": "579",
    "plg_version": "2.2.3",
    "qdt_version": "0.43.2"
  },
  "SpreadsheetLayers": {
    "installed_at": "2026-07-28T13:55:27.327208+00:00",
    "plg_id": "766",
    "plg_version": "2.1.0",
    "qdt_version": "0.43.2"
  },
  "menu_from_project": {
    "installed_at": "2026-07-30T10:11:48.207404+00:00",
    "plg_id": "43",
    "plg_version": "2.4.4",
    "qdt_version": "0.43.2"
  },
  "qNote": {
    "installed_at": "2026-07-28T13:55:27.269434+00:00",
    "plg_id": "122",
    "plg_version": "2.3",
    "qdt_version": "0.43.2"
  },
  "quick_map_services": {
    "installed_at": "2026-07-28T13:55:27.273391+00:00",
    "plg_id": "666",
    "plg_version": "0.19.33",
    "qdt_version": "0.43.2"
  },
  "redLayer": {
    "installed_at": "2026-07-28T13:55:27.323654+00:00",
    "plg_id": "752",
    "plg_version": "2.2",
    "qdt_version": "0.43.2"
  }
}

This manifest enables QDT to:

  • Clearly identify plugins it has installed.
  • Distinguish these from plugins users may have installed manually.
  • Confidently decide which ones can be removed during cleanup.

The new “Cleanup Manager” job (and qdt cleanup CLI command)

Building on these new foundations, a new job has been added: Cleanup Manager, usable in QDT scenarios to:

  • Automatically clean up “stale” resources from previous deployments. For now:
    • local plugins archives cache
    • “orphan” plugins: present on disk but not declared in any QGIS profile managed by QDT).

The same capability is also exposed as a CLI command:

qdt cleanup --help

This allows, for example, integrating regular cleanup into:

  • A maintenance script run periodically on workstations.
  • A scheduled task (PowerShell, GPO, etc.) that calls qdt cleanup after each profile update.

In the context of the Métropole du Grand Lyon, this translates to:

  • QGIS profiles that evolve without indefinitely accumulating old plugins.
  • Reduced risk of conflicts between plugin versions.
  • Better visibility for administrators: exactly what QDT manages and what it can clean is now clear.

Availability and funding

All these improvements are available in version 0.44.0 of QGIS Deployment Toolbelt, released today:

The PRs and release notes specify that these developments were funded by the Métropole du Grand Lyon.

Feedback is welcome!

1 Like