Dynamically generate typespecs from module attribute list

We’ve also now extracted this into a little library:

https://github.com/felt/union_typespec

One of the main reasons to extract it was to avoid extra compile-time dependencies.