Skip to content

Improved static typing in dash.callback#3746

Open
odorikakeru wants to merge 6 commits intoplotly:devfrom
odorikakeru:baker/typed-callback
Open

Improved static typing in dash.callback#3746
odorikakeru wants to merge 6 commits intoplotly:devfrom
odorikakeru:baker/typed-callback

Conversation

@odorikakeru
Copy link
Copy Markdown

This PR improves static typing for the callback decorator by preserving wrapped function signatures in the callback decorator type contract.

Based on this conversation thread: [Feature Request] A "@dash.typed_callback" that plays more nicely with MyPy than "@dash.callback" #3691 - The decision was made to not implement @dash.typed_callback and instead update @dash.callback based on feedback.

Compliance tests added (not included in integration test directory as type hints don't affect run time behaviour).

DISCLOSURE: Testing code was written/edited with AI assistance.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • Update callback decorator type signature
    • Add and validate callback decorator typing/runtime tests (some testing code written with AI assistance)
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant