Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing support #33

Closed
dave-shawley opened this issue Sep 16, 2021 · 0 comments · Fixed by #41
Closed

Add typing support #33

dave-shawley opened this issue Sep 16, 2021 · 0 comments · Fixed by #41
Milestone

Comments

@dave-shawley
Copy link
Contributor

I started an effort to do this a few years ago (see #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:

  • represent expectations using structural sub-typing and typing.Protocol sub-classes explicitly
  • add type definitions for precisely we know how to serialize -- IOW, define a union type like SerializableTypes
  • document the definitions and expected usage
  • pull mypy (maybe pyright?) into the build chain

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.

@dave-shawley dave-shawley added this to To Do in Milestone 3.1 Sep 16, 2021
@dave-shawley dave-shawley moved this from To Do to In Progress in Milestone 3.1 Sep 16, 2021
@dave-shawley dave-shawley removed this from In Progress in Milestone 3.1 Sep 16, 2021
@dave-shawley dave-shawley added this to To Do in Milestone 3.1 via automation Sep 16, 2021
@dave-shawley dave-shawley added this to the 3.1.0 milestone Sep 16, 2021
@dave-shawley dave-shawley removed this from To Do in Milestone 3.1 Sep 16, 2021
@cknave cknave closed this as completed in #41 Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant