sec_interp.core.utils.metadata_reader module
Utility for reading plugin metadata from metadata.txt.
This module provides functionality to read plugin information from the standard QGIS metadata.txt file, ensuring a single source of truth for plugin version, author, and other metadata.
- sec_interp.core.utils.metadata_reader.clear_metadata_cache() None
Clear the metadata cache.
Useful for testing or when metadata.txt is updated at runtime.
- sec_interp.core.utils.metadata_reader.read_plugin_metadata() dict[str, str]
Read plugin metadata from metadata.txt.
Reads the standard QGIS metadata.txt file and extracts key information about the plugin. Results are cached to avoid repeated file I/O.
- Returns:
- Dictionary containing plugin metadata with keys:
name: Plugin name
version: Plugin version
author: Plugin author
email: Contact email
description: Short description
homepage: Documentation URL (if available)
repository: Source code URL (if available)
- Return type:
Dict[str, str]
- Raises:
FileNotFoundError – If metadata.txt cannot be found
ValueError – If required fields (name, version, author, email) are missing
Example
>>> metadata = read_plugin_metadata() >>> print(f"{metadata['name']} v{metadata['version']}") Sec Interp v2.9.0