Skip to content

Fix typing tests on mypy 2.4.1 - #4189

Merged
T4rk1n merged 4 commits into
devfrom
fix/mypy-2-page-registry
Nov 26, 2026
Merged

T4rk1n merged 4 commits into
devfrom
fix/mypy-2-page-registry

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Dependabot's mypy bump to 2.4.1 (#4181) fails the Typing Tests job with:

dash/_pages.py:20: error: Need type annotation for "PAGE_REGISTRY"  [var-annotated]

mypy 2 now requires a type for the empty collections.OrderedDict(). This PR annotates it as OrderedDict[str, dict[str, Any]] (module name to the page dict built in register_page) and bumps the mypy pin to 2.4.1, so CI runs the typing suite on the new version.

This only shows up when mypy runs from a dash checkout, as the typing tests do. Apps that use an installed dash are not affected, so there's no changelog entry.

Checked

  • With mypy 2.4.1 in a clean tree set up like the CI job (dash installed from the wheel, no built components in the source tree), tests/compliance/test_typing.py and test_callback_typing.py (-k mypy): 14 failed on dev, 17 passed with this change. mypy 1.15.0 still passes.
  • pyright, pylint and flake8 are clean on dash/_pages.py; page unit tests and tests/integration/multi_page/test_pages_layout.py pass.

The celery bump in #4181 is left to that PR.

mypy 2 requires a type for the empty OrderedDict and fails the typing
tests with var-annotated on dash/_pages.py.
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Dash performance benchmarks

✅ all within thresholds

scenario metric p90 (ms) median growth baseline p90 note
✅ callback_chain chain_ms 333.3 320.7 0.92x 595.4
✅ callback_chain graph_ms 1.5 1.5 1.0x 2.1
✅ callback_fanout fanout_ms 72.5 62.1 0.94x 88.3
✅ callback_fanout_children_update fanout_ms 114.4 109.6 0.97x 164.8
✅ deep_nesting render_ms 43.2 40.8 1.25x 61.1
✅ full_children_replace replace_ms 131.6 85.4 2.79x 161.2
✅ initial_render_large render_ms 474.1 427.4 0.95x 697.8
✅ initial_render_small render_ms 80.8 71.1 0.93x 102.7
✅ patch_append_nested append_ms 104.0 74.6 2.33x 127.2
✅ patch_append_toplevel append_ms 98.2 66.1 2.32x 165.8
✅ patch_scalar_update_large update_ms 124.7 105.1 0.84x 144.7
✅ rerender_existing_subtree rerender_ms 92.5 78.9 0.96x 121.0
✅ wildcard_all_resolve wildcard_ms 222.4 213.1 0.94x 313.4
✅ wildcard_all_resolve graph_ms 0.9 0.9 1.0x 1.2

growth = late-third / early-third per-op time; ~1 is flat, a large value means the per-op cost scales with accumulated state.

machine scale vs baseline: 0.72x - divided out of the baseline ratios so they compare like for like (the absolute warn/fail ceilings are left un-scaled); calibrated on initial_render_small.

@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n
T4rk1n merged commit f9a92df into dev Nov 26, 2026
63 checks passed
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