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

Adding type hints #474

Open
0x6475796e6861 opened this issue Dec 9, 2024 · 1 comment · May be fixed by #477
Open

Adding type hints #474

0x6475796e6861 opened this issue Dec 9, 2024 · 1 comment · May be fixed by #477

Comments

@0x6475796e6861
Copy link

As mentioned in Pyramid's issue #2638, I would like to start adding type annotations to WebOb.

Since I don't really know the code base really well (I'm learning on the go!), I'm planning to make many little PRs so that they are easily reviewed and get feedbacks quickly (also because they should not affect runtime at all).

Can I get a green light on this?

Also, is it okay to make use of this issue to track progress? Google group is too noisy for my liking.

@Daverball
Copy link

FYI there are existing stubs for WebOb I contributed to typeshed that are fairly complete and should provide a good starting point: https://github.com/python/typeshed/tree/main/stubs/WebOb

There is however a prevalent use of asymmetric properties and factory functions that create such properties, although you should be able to get away with relying on the protocols I defined. Although in the long run you may want to consider defining purpose-built descriptors, so there's less casting/type ignores.

There's also #452 that's slightly related to this, since the multidict implementation is currently not type safe. If we switch to the multidict package we will get type hints for free, we just need to add a new NestedMultiDict and NoVars implementation on top of the MultiMapping ABC.

@Daverball Daverball linked a pull request Feb 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants