sprockets / sprockets.mixins.mediatype

Handles Content-Type & Accept header serialization and deserialization for you
https://sprocketsmixinsmedia-type.readthedocs.io
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

Add typing support #33

Closed dave-shawley closed 3 years ago

dave-shawley commented 3 years ago

I started an effort to do this a few years ago (see https://github.com/sprockets/sprockets.mixins.mediatype/pull/23) but it fizzled since the typing SIG was still changing things. Now that things have settled done in the part of the ecosystem, I'd like to reboot it. I still like the approach that I took in my original branch:

The one downside is that typing.Protocol was added in 3.8 and we still support 3.7. We can use the typing.extensions package as a backport. For this reason, I would isolate the typing-related classes into a module named sprockets.mixins.mediatype.type_info and use it in conjunction with typing. The goal is to not let the non-3.7 compatibility stuff leak out of the module.

Feel free to steal, adopt, and/or ignore portions of my original branch.