Description of problem:
dnf api lacks an option for `dnf autoremove`
Version-Release number of selected component (if applicable):
Im working on adding `dnf autoremove` for the dnf module in ansbile. The related issue is here: https://github.com/ansible/ansible/issues/18815
Currently the only way to autoremove unneeded packages is by explicitly removing one installed package and dnf would autoremove all other unneeded packages by default but there is no way to just remove the unneeded packages without marking an installed package for removal too.
A base.autoremove() api can get be used for this task.
A base.sack.query().unneeded() api could make it possible to get a list of the packages that are candidate to be removed and have more control over the packages
to remove than base.autoremove()
Fixed by https://github.com/rpm-software-management/dnf/pull/716
Bugs fixed in version 2.0.1-1.