
Python-hglib is a library with a fast, convenient interface to Mercurial. It uses Mercurial's command server for communication with hg. This approach avoids relying on Mercurial's (unstable) internal Python API, and avoids licensing issues for non-GPL code.