As an example of how pkgcore can be useful as a library even if you are not programming in python see source:sandbox/pserver, which is an xmlrpc server for doing simple pquery-like queries. This is just a demonstration, it can easily be extended to return more data and allow different kinds of queries.

To run this you need at least twisted-2.4.0 and twisted-web-0.6.0. Start the server with "twistd -noy pserver.tac". To query it do something like this (in python):

>>> import xmlrpclib
>>> server = xmlrpclib.ServerProxy('http://localhost:12345')
>>> server.match('python')
<lots of data>
>>> server.revdep('dev-util/bzr')
<more data, after a rather long delay>

Equivalent in a different language is left as an excercise to the reader :)

None of the pkgcore developers currently need this functionality (we can just write our programs in python and use pkgcore directly). If you could use something like this, please get in touch so we can add the functionality you need. Using a different rpc system than xmlrpc is probably possible too (as long as we do not have to write the python bindings for it).