Libcomps is alternative for yum.comps library. It's written in pure C as library and there's bindings for python2 and python3.