Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add python type hinting #15857

Copy link
Copy link

Description

@schwehr
Issue body actions

This is work that might be contributed by folks other than the maintainers.

Is your feature request related to a problem? Please describe.

Checking types in python has been loose and folks sometimes get themselves in trouble when trying to modify older code bases. It's not always obvious to the reader of the code what type(s) should be in play for particular code. Having type hints in python-ndb would help a bit with that.

Describe the solution you'd like

If the project is up for it, say that you are okay with PRs that setup testing of type hinting (pytype and/or mypy) and then adding type hinting. Then maybe we can round up some contributors.

Describe alternatives you've considered

It's okay to not add type hinting. It solves only a particular set of issues. And users of the library should have test coverage exercising all of their use, but that can sometimes be a difficult bar to achieve.

Additional context

I personally have found I'm faster at modifying code with type hints and create fewer bugs in that code. YMMV.

Additionally there needs to be a couple decisions:

  • Python typing work better with newer versions of python
  • Does the project allow from __future__ import annotations?
  • How much type hinting to allow?
  • When to just punt and use Any? e.g. Dict[str, Any] for JSON rather than something super messy
  • Which checker(s) to use? pytype, mypy, and/or what?
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.