DNF plugin can be any Python class fulfilling the following criteria:
- it derives from
- it is made available in a Python module stored in one of the
- provides its own
When DNF CLI runs it loads the plugins found in the paths during the CLI’s initialization.
The base class all DNF plugins must derive from.
Plugin must set this class variable to a string identifying the plugin. The string can only contain alphanumeric characters and underscores.
Plugin must override this. Called immediately after all the plugins are loaded. base is an instance of
dnf.Base. cli is an instance of
dnf.cli.Clibut can also be
Nonein case DNF is running without a CLI (e.g. from an extension).
Plugin can override this. This hook is called immediately after the CLI/extension is finished configuring DNF. The plugin can use this to tweak the global configuration or the repository configuration.
Plugin can override this. This hook is called immediately after the CLI has finished resolving a transaction. The plugin can use this to inspect the resolved but not yet executed
Plugin can override this. This hook is called immediately after
Base.sackis initialized with data from all the enabled repos.
Plugin can override this. This hook is called immediately after a successful transaction.
You may want to see the comparison with yum plugin hook API.