Skip to content

Adding type hints #474

Open
Open

Description

@0x6475796e6861

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.

Activity

  1. Daverball commented on Jan 31, 2025

    @Daverball

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions