Open
Description
The following minimum example:
from typing import Any
from dash import Dash, html, dash_table, dcc
app = Dash()
app.layout = html.Div(
[
html.H3("Initial Title", id="my-title"),
html.Div(
dash_table.DataTable(
id="table",
columns=[
{"name": "Type", "id": "Type"},
{"name": "Processed", "id": "Processed"},
{"name": "Start", "id": "Start"},
{"name": "End", "id": "End"},
],
style_cell={"textAlign": "left"},
filter_action="native",
sort_action="native",
),
),
],
className="topmenu",
role="button",
**{"aria-pressed": "false"},
)
class MyGraph(dcc.Graph):
"""Subclass of dash_core_components.Graph to remove modeBarButtons"""
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(
*args,
**kwargs,
config=dict(modeBarButtonsToRemove=["sendDataToCloud"]),
)
Generates no issues with mypy 1.15.0 and Dash 3.0.2. Then upgrading to Dash 3.0.4
(venv) PS C:\Users\gxvh\Python\dash_mypy> mypy
Success: no issues found in 1 source file
(venv) PS C:\Users\gxvh\Python\dash_mypy> poetry update
Updating dependencies
Resolving dependencies... (54.3s)
Package operations: 0 installs, 1 update, 0 removals
- Updating dash (3.0.2 -> 3.0.4)
Writing lock file
(venv) PS C:\Users\gxvh\Python\dash_mypy> mypy
dash_test.py:11: error: Module has no attribute "DataTable" [attr-defined]
dash_test.py:27: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "SupportsFloat | SupportsInt | SupportsComplex | None" [arg-type]
dash_test.py:27: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "bool | None" [arg-type]
dash_test.py:27: error: Argument 4 to "Div" has incompatible type "**dict[str, str]"; expected "Literal['hidden', 'HIDDEN'] | bool | None" [arg-type]
dash_test.py:35: error: "__init__" of "Graph" gets multiple values for keyword argument "config" [misc]
Found 5 errors in 1 file (checked 1 source file)
(venv) PS C:\Users\gxvh\Python\dash_mypy>