Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).

## [UNRELEASED]

### Fixed
- [#4220](https://github.com/plotly/dash/pull/4220) Fix the `DASH_VALIDATE_CALLBACKS` environment variable being ignored, although `Dash.run` and `Dash.enable_dev_tools` document it for `dev_tools_validate_callbacks`. Fixes [#4219](https://github.com/plotly/dash/issues/4219).

## [4.5.2] - 2026-11-27

### Changed
Expand Down
1 change: 1 addition & 0 deletions dash/_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def load_dash_env_vars():
"DASH_SILENCE_ROUTES_LOGGING",
"DASH_DISABLE_VERSION_CHECK",
"DASH_PRUNE_ERRORS",
"DASH_VALIDATE_CALLBACKS",
"DASH_COMPRESS",
"DASH_MCP_ENABLED",
"DASH_MCP_PATH",
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/devtools/test_callback_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,3 +917,14 @@ def c(_):
wait.until(lambda: ~dash_duo.redux_state_is_loading, 2)
dash_duo.wait_for_no_elements(dash_duo.devtools_error_count_locator)
assert dash_duo.get_logs() == []


def test_validate_callbacks_env_var_reaches_page_config(empty_environ, monkeypatch):
monkeypatch.setenv("DASH_VALIDATE_CALLBACKS", "false")
app = Dash(__name__)
app.layout = html.Div()
app.enable_dev_tools(debug=True, dev_tools_hot_reload=False)

page = app.server.test_client().get("/").get_data(as_text=True)

assert re.search(r'"validate_callbacks": ?false', page)
25 changes: 25 additions & 0 deletions tests/unit/test_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,31 @@ def test_debug_mode_enable_dev_tools(empty_environ, debug_env, debug, expected):
assert app._dev_tools.ui == expected


@pytest.mark.parametrize(
"validate_callbacks_env, debug, validate_callbacks, expected",
[
("false", True, None, False),
("true", False, None, True),
("true", True, False, False),
(None, True, None, True),
(None, False, None, False),
],
)
def test_validate_callbacks_enable_dev_tools(
empty_environ,
monkeypatch,
validate_callbacks_env,
debug,
validate_callbacks,
expected,
):
if validate_callbacks_env:
monkeypatch.setenv("DASH_VALIDATE_CALLBACKS", validate_callbacks_env)
app = Dash()
app.enable_dev_tools(debug=debug, dev_tools_validate_callbacks=validate_callbacks)
assert app._dev_tools.validate_callbacks == expected


def test_missing_flask_compress_raises():
with pytest.raises(ImportError):
Dash(compress=True)
Expand Down
Loading