Boolean option, if set to
Trueon any user input asking for confirmation (e.g. after transaction summary) the answer is implicitly
yes. Default is
Trueinstructs the solver to either use a package with the highest available version or fail. On
False, do not fail if the latest version can not be installed. Default is
Path to a directory used by various DNF subsystems for storing cache data. Has a reasonable root-writable default depending on the distribution. It is up to the client to set this to a location where files and directories can be created under the running user. The directory can be safely deleted after the
dnf.Baseobject is destroyed
Boolean option. Specifies whether dnf should automatically expire metadata of repos, which are older than their corresponding configuration file (usually the dnf.conf file and the foo.repo file). Default is
True(perform the check).
Trueremoves dependencies that are no longer used during
dnf remove. A package only qualifies for removal via
clean_requirements_on_removeif it was installed through DNF but not on explicit user request, i.e. it was pulled in as a dependency. The default is
True. (installonlypkgs are never automatically removed.)
Path to the default main configuration file. Default is
Debug messages output level, in the range 0 to 10. Default is 2.
Integer option. When the relative size of delta vs pkg is larger than this, delta is not used. Default value is 75 (%). Use 0 to turn off delta rpm processing. Local repositories (with file:// baseurl) have delta rpms always turned off.
Exclude packages specified by <pkgs> from the operation.
Boolean option, if set to
Truednf client exits immediately when something else has the lock. Default is
Returns the value of the first valid reposdir or if unavailable the value of created reposdir (string)
List of the following: optional, default, mandatory. Tells dnf which type of packages in groups will be installed when ‘groupinstall’ is called. Default is: default, mandatory
List of provide names of packages that should only ever be installed, never upgraded. Kernels in particular fall into this category. These packages are never removed by
dnf autoremoveeven if they were installed as dependencies (see clean_requirements_on_remove for auto removal details). This option overrides the default installonlypkgs list used by DNF. The number of kept package versions is regulated by installonly_limit.
An integer to limit the number of installed installonly packages (packages that do not upgrade, instead few versions are installed in parallel). Defaults to
0, that is the limiting is disabled.
When this boolean option is set to True and a new package is about to be installed, all packages linked by weak dependency relation (Recommends or Supplements flags) with this package will pulled into the transaction. Default is True.
The root of the filesystem for all packaging operations.
Keeps downloaded packages in the cache when this boolean option is set to True. Even if it is set to False and packages have not been installed they will still persist until next successful transaction. The default is False.
Directory where the log files will be stored. Default is
Controls how multilib packages are treated during install operations. Can either be
"best"(the default) for the depsolver to prefer packages which best match the system’s architecture, or
"all"to install all available packages with compatible architectures.
Directory where the data that DNF keeps track of between different runs is stored. Default is
List of directories that are searched for plugin configuration to load. All configuration files found in these directories, that are named same as a plugin, are parsed. The default contains
List of directories where DNF searches for plugins. The default contains a Python version-specific path.
URL of of a proxy server to use for network connections. Defaults to
None, i.e. no proxy used. The expected format of this option is:
List of packages that DNF should never completely remove. They are protected via Obsoletes as well as user/plugin removals.
The username to use for connecting to the proxy server. Defaults to
The password to use for connecting to the proxy server. Defaults to
Used for substitution of
$releaseverin the repository configuration.
List of directories to search for repo configuration files. Has a reasonable default commonly used on the given distribution.
Number of times any attempt to retrieve a file should retry before returning an error. Setting this to 0 makes it try forever. Defaults to 10.
Path to the directory or file containing the certificate authorities to verify SSL certificates. Defaults to None - uses system default.
Whether SSL certificate checking should be performed at all. Defaults to
Path to the SSL client certificate used to connect to remote sites. Defaults to None.
Path to the SSL client key used to connect to remote sites. Defaults to None.
A mapping of substitutions used in repositories’ remote URL configuration. The commonly used ones are:
key meaning default arch architecture of the machine autodetected basearch the architecture family of the current “arch” autodetected releasever release name of the system distribution
dnf.rpm.detect_releasever()can be used to detect the
Following example shows recommended method how to override autodetected architectures:
import dnf import dnf.arch base = dnf.Base() base.conf.substitutions['arch'] = arch base.conf.substitutions['basearch'] = dnf.rpm.basearch(arch) base.fill_sack() ...
List of strings adding extra flags for the RPM transaction.
tsflag RPM Transaction Flag noscripts RPMTRANS_FLAG_NOSCRIPTS test RPMTRANS_FLAG_TEST notriggers RPMTRANS_FLAG_NOTRIGGERS nodocs RPMTRANS_FLAG_NODOCS justdb RPMTRANS_FLAG_JUSTDB nocontexts RPMTRANS_FLAG_NOCONTEXTS nocrypto RPMTRANS_FLAG_NOFILEDIGEST
"nocrypto"option will also set the
The username to use for connecting to repo with basic HTTP authentication. Defaults to
Set this to False to disable the automatic running of
group upgradewhen running the
upgradecommand. Default is
True(perform the operation).
The password to use for connecting to repo with basic HTTP authentication. Defaults to
Read configuration options from the
mainsection in filename. Option values not present there are left at their current values. If filename is
config_file_pathis used. Conversely, the configuration path used to load the configuration file that was used is stored into
config_file_pathbefore the function returns.
Print configuration values, including inherited values.
write_raw_configfile(filename, section_id, substitutions, modify)¶
Update or create config file. Where filename represents name of config file (.conf or .repo); section_id represents id of modified section (e.g. main, fedora, updates); substitutions represents an instance of base.conf.substitutions; modify represents dict of modified options.