# DNF API Reference

## Introduction

The provided Python API to DNF is supposed to mainly allow writing the following two categories of programs:

1. plugins to DNF which extend functionality of the system's DNF installation.

2. extension applications that embed DNF (by importing its Python modules) to perform specific package management tasks.

Please refer to the DNF Use Cases where you can find examples of API usage.

Note

The API consists of exactly those elements described in this document, items not documented here can change release to release. Opening a bugzilla if certain needed functionality is not exposed is the right thing to do.

## Versioning

DNF follows the Semantic Versioning as defined at http://semver.org/.

This basically means that if your piece of software depends on e.g. DNF 1.1, the requirement can be specified as `1.1 <= dnf < 2`. In other words, you can be sure that your software will be API-compatible with any later release of DNF until the next major version is issued. The same applies for the CLI compatibility.

Incompatible API changes are subject to our deprecation policy. Deprecated API items (classes, methods, etc.) are designated as such in the DNF Release Notes. The first release where support for such items can be dropped entirely must have, relative to the deprecating release, a higher major version number. DNF will log a warning when a deprecated item is used.

## Contents

API Documentation Contents

- Common Provisions of the DNF API
  - Logging
- `Base`---The centerpiece of DNF
  - `dnf.Base`
- Exceptions
  - `dnf.exceptions.Error`
  - `dnf.exceptions.CompsError`
  - `dnf.exceptions.DeprecationWarning`
  - `dnf.exceptions.DepsolveError`
  - `dnf.exceptions.DownloadError`
  - `dnf.exceptions.MarkingError`
  - `dnf.exceptions.MarkingErrors`
  - `dnf.exceptions.RepoError`
- Configuration
  - `dnf.conf.Conf`
  - `dnf.conf.substitutions.Substitutions`
- Repository Configuration
  - `dnf.repodict.RepoDict`
  - `repo_id_invalid()`
  - `Metadata`
  - `Repo`
- Sack
  - `Sack`
  - `rpmdb_sack()`
- Queries and Subjects
  - `Query`
  - `Subject`
- Selector
  - `dnf.selector.Selector`
- Package
  - `dnf.package.Package`
- Transaction
  - `RPMTransaction`
- Comps, or the Distribution Compose Metadata
  - `Comps`
  - `Package`
  - `Category`
  - `Environment`
  - `Group`
  - `CONDITIONAL`
  - `DEFAULT`
  - `MANDATORY`
  - `OPTIONAL`
- Plugin Interface
  - `dnf.Plugin`
  - `register_command()`
- Progress Reporting with Callbacks
  - `Payload`
  - `DownloadProgress`
  - `TransactionProgress`
- RPM Interface
  - `detect_releasever()`
  - `detect_releasevers()`
  - `basearch()`
- Command Line Interface Hooks
  - `CliError`
  - `dnf.cli.demand.DemandSheet`
  - `Command`
  - `Cli`
- Modularity Interface
  - `dnf.module.module_base.ModuleBase`
  - `__init__()`
  - `enable()`
  - `disable()`
  - `reset()`
  - `install()`
  - `remove()`
  - `upgrade()`
  - `get_modules()`
  - `libdnf.module.ModulePackage`
  - `getName()`
  - `getStream()`
  - `getVersion()`
  - `getVersionNum()`
  - `getContext()`
  - `getArch()`
  - `getNameStream()`
  - `getNameStreamVersion()`
  - `getFullIdentifier()`
  - `getProfiles()`
  - `getSummary()`
  - `getDescription()`
  - `getRepoID()`
  - `getArtifacts()`
  - `getModuleDependencies()`
  - `getYaml()`
  - `libdnf.module.ModuleProfile`
  - `libdnf.module.ModuleDependencies`
  - `libdnf.module.ModulePackageContainer`

Indices:

- Index