Skip to content

Fix typing tests on mypy 2.4.1 - #4189

Open
T4rk1n wants to merge 2 commits into
devfrom
fix/mypy-2-page-registry
Open

T4rk1n wants to merge 2 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 442.4 431.8 0.91x 499.1
✅ callback_chain graph_ms 1.5 1.5 1.0x 2.4
✅ callback_fanout fanout_ms 73.0 68.0 0.86x 92.5
✅ deep_nesting render_ms 50.5 46.6 1.22x 56.8
✅ full_children_replace replace_ms 141.4 92.5 2.81x -
✅ initial_render_large render_ms 475.3 449.1 0.99x 694.4
✅ initial_render_small render_ms 104.1 77.4 1.17x 104.0
✅ patch_append_nested append_ms 139.1 97.1 2.55x 192.3
✅ patch_append_toplevel append_ms 139.8 101.2 2.51x 140.2
✅ patch_scalar_update_large update_ms 160.7 152.4 0.86x 202.9
✅ rerender_existing_subtree rerender_ms 119.7 102.2 0.89x -
✅ wildcard_all_resolve wildcard_ms 233.1 228.4 0.94x 313.6
✅ wildcard_all_resolve graph_ms 0.8 0.8 1.0x 1.3

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.81x - 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

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