GnuCash after its guille-inflicted near death experience (how many volunteers you find maintaining Scheme-based accounting package? The answer has been proven to be zero) has now Python API and some efforts to include some small-business oriented features. Certainly from all options discussed it seems to me the most realistic option, much better than starting with awk scripts and PostgreSQL.