Skip to content

Include type hints in function parameters #2233

Description

@ldorigo

Hi,

Static type checkers (mypy, pyright/pylance) are becoming increasingly popular in the python world.
For now they don't work with Dash as there are no type annotations included with the library.

From what I understand, python code for dash components as well as their docstrings are somehow transpiled from javascript? If so, adding type hints should be relatively straightforward as it appears that the docstrings already contain very detailed typing information. This would significantly improve QOL for users using type checkers (which includes the majority of the vscode userbase since vscode uses pylance by default).

For reference, plotly has also started adding typing information to their functions - see for instance plotly/plotly.py#3425 (comment) .

Activity

  1. tuchandra commented on Sep 30, 2022

    @tuchandra

    Huge +1 from me; the developer experience of using a library that type hints its parameters is unmatched. There's some related work I've stumbled on:

  2. ajrheaume commented on Mar 19, 2024

    @ajrheaume

    Type hints would be super useful! Any update about this feature request?

  3. gvwilson commented on Jul 26, 2024

    @gvwilson
    Contributor

    @T4rk1n will your work on the code generator take care of this as a side effect?

  4. T4rk1n commented on Jul 26, 2024

    @T4rk1n
    Contributor

    @T4rk1n will your work on the code generator take care of this as a side effect?

    No, it is a task on it's own to add the typing to all API methods and then there is #2170 which are all typing related.

  5. changed the title [-][Feature Request] Include type hints in function parameters?[/-] [+]Include type hints in function parameters[/+] on Aug 13, 2024
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

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions