Skip to content

Type hint stubs #491

@paravoid

Description

@paravoid

It'd be awesome if client_python was type hinted, as that would allow downstream consumers to typecheck their API calls (one has to explicitly # type: ignore the import right now).

My understanding is that the project is actively trying to support (very) old versions of Python. In this case, there are two options: a) type hints in comments b) type stubs (.pyi). The latter is preferrable; this can be shipped by either typeshed, or, ideally, in the software itself. For more about the pros and cons of each solution, I've found Bernat Gabor's blog post to be informative.

Adding the hints across the entire code base is easy but still, not a trivial amount of work. Tools like MonkeyType can help bootstrap that process. Given the good code test coverage, I tried running the test suite with MonkeyType (monkeytype run -m pytest) and it generated the majority of the hints. There were, however, some corner cases that it wasn't able to figure out or otherwise failed to generate, and I'm not familiar enough with the codebase to help with that.

Thanks & thanks for all of the work you've been putting on this module!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions