I think it's worth mentioning that this is posted on NeoPG's site, which is a fork of GnuPG which seems to do really good work. I'm glad to see this happening since I'm using these tools and fixes are on the way :)
Specifically seems to be a fork providing a more concrete API, rather than GPG which has a CLI most people wrap.
Lots of bugs caused by that sort of thing, unfortunately it's all we have for GPG.
EDIT: It appears I was mistaken, the "GPGME" project also exists. I am not sure if that has some serious deficiencies that mean it's not used more often never the less, it's not the only option.