Skip to content

Adding type hints to the codebase #1608

Open

Description

@outa

Use Case/Motivation

Hi,

how do you feel about adding type hints to functions and methods in the code?

I think that in addition to catching and avoiding bugs, it would also make the code easier to understand for new contributors.

Plus one could add some kind of static type checker to the CI

Example Usage

n/a

Other Information

I'm willing to submit a PR

Activity

  1. micahellison commented on Oct 8, 2022

    @micahellison
    Member

    Thanks for filing this, and yes, we're into it! Just a couple things to be mindful of:

    Right now we have an open draft PR #1602 that does this in a few places, so it might be worth glancing at that so you don't have to duplicate any work.

    The other issue is that type hints have been changing rapidly over the past few Python releases, as we're seeing in that same PR (the tests in Python 3.9 are failing). We plan to merge it when we drop Python 3.9 support later this month, so don't worry about any failing 3.9 tests if you tackle this.

  2. added this to the Backlog milestone on Oct 8, 2022
  3. micahellison commented on Nov 5, 2022

    @micahellison
    Member

    The bulk of the work is done (thanks @outa) though I'm leaving this open because we don't quite have enough static type checking yet. Once we have that in place and without errors, I think we can close this issue.

    Looks like we'll probably be picking between mypy and pedantic, or maybe others. Suggestions are welcome.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions