psycogreen -- integrate psycopg2 with coroutine libraries
Psycopg is a C extension module, so it can't be monkey-patched to be coroutine-friendly. Instead it now exposes a hook where a coroutine library can install its wait code. Psycopg will call the hook whenever it executes a libpq call that may block. Coroutine libraries can implement their "wait callaback" in order to have a chance to schedule a coroutine switch.
The psycogreen package is a contained of callbacks to make psycopg2 work with coroutine libraries, using asynchronous calls internally but offering a blocking interface so that regular code can run unmodified.