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
12 changes: 10 additions & 2 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ const sh_cd = (directory, command) => {

module.exports = {
// Python checks (run from root, using root venv)
"*.py": (filenames) => [
"dash/*.py": (filenames) => [
`${venvBin("python")} -m pylint --rcfile=.pylintrc ${filenames.join(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved linting configuration by separating rules for source vs test files

" "
)}`, // Add your pylintrc if you have one
)}`,
`${venvBin("flake8")} ${filenames.join(" ")}`,
`${venvBin("black")} --check ${filenames.join(" ")}`,
],

"**/tests/**/*.py": (filenames) => [
`${venvBin("python")} -m pylint -d all -e C0410,C0413,W0109 --rcfile=.pylintrc ${filenames.join(
" "
)}`,
`${venvBin("flake8")} ${filenames.join(" ")}`,
`${venvBin("black")} --check ${filenames.join(" ")}`,
],
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [UNRELEASED]

## Fixed
- [#3341](https://github.com/plotly/dash/pull/3341) Fixed query string parsing regression introduced in 2.18.2 where values containing unencoded `&` characters were being truncated. [#3106](https://github.com/plotly/dash/issues/3106)
- [#3279](https://github.com/plotly/dash/pull/3279) Fix an issue where persisted values were incorrectly pruned when updated via callback. Now, callback returned values are correctly stored in the persistence storage. Fix [#2678](https://github.com/plotly/dash/issues/2678)
- [#3298](https://github.com/plotly/dash/pull/3298) Fix dev_only resources filtering.
- [#3315](https://github.com/plotly/dash/pull/3315) Fix pages module is package check.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time

import pytest
import werkzeug

from dash import Dash, Input, Output, html, dcc, no_update

Expand Down Expand Up @@ -75,11 +74,6 @@ def test_dtps010_local_and_session_persistence(dash_dcc):
assert dash_dcc.get_logs() == []


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
def test_dtps011_memory_persistence(dash_dcc):
app = Dash(__name__)
app.layout = html.Div(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time
import json

import werkzeug
from selenium.webdriver import ActionChains

from dash import Dash, Input, Output, State, dcc, html
Expand Down Expand Up @@ -229,10 +228,6 @@ def assert_graph_equals(browser, graph_id, graph_data):
assert y == expected_y


@pytest.mark.skipif(
werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with no_update 204 responses get Transfer-Encoding header.",
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_grva004_graph_prepend_trace(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down Expand Up @@ -380,10 +375,6 @@ def trace_will_prepend_with_max_points(n_intervals):
assert dash_dcc.get_logs() == []


@pytest.mark.skipif(
werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with no_update 204 responses get Transfer-Encoding header.",
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_grva005_graph_extend_trace(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import pytest
import werkzeug

import dash.testing.wait as wait


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
def test_stdl001_data_lifecycle_with_different_condition(store_app, dash_dcc):
dash_dcc.start_server(store_app)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import werkzeug

from dash import Dash, Input, Output, dcc, html
from dash.exceptions import PreventUpdate
import json
Expand Down Expand Up @@ -117,11 +115,6 @@ def render_content(tab):
assert dash_dcc.get_logs() == []


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_tagr002_tabs_render_without_selected(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down
24 changes: 10 additions & 14 deletions dash/_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
import re
import sys
from fnmatch import fnmatch
from pathlib import Path
from os.path import isfile, join
from urllib.parse import parse_qs, unquote
from pathlib import Path
from urllib.parse import parse_qs

import flask

from . import _validate
from ._utils import AttributeDict
from ._get_paths import get_relative_path
from ._callback_context import context_value
from ._get_app import get_app

from ._get_paths import get_relative_path
from ._utils import AttributeDict

CONFIG = AttributeDict()
PAGE_REGISTRY = collections.OrderedDict()
Expand Down Expand Up @@ -114,17 +113,14 @@ def _infer_module_name(page_path):


def _parse_query_string(search):
search = unquote(search)
if search and len(search) > 0 and search[0] == "?":
search = search[1:]
else:
if not search or not search.startswith("?"):
return {}

parsed_qs = {}
for (k, v) in parse_qs(search).items():
v = v[0] if len(v) == 1 else v
parsed_qs[k] = v
return parsed_qs
query_string = search[1:]

parsed_qs = parse_qs(query_string, keep_blank_values=True)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change adding keep_blank_values=True to preserve empty parameters in query string parsing

return {k: v[0] if len(v) == 1 else v for k, v in parsed_qs.items()}


def _parse_path_variables(pathname, path_template):
Expand Down
4 changes: 2 additions & 2 deletions requirements/install.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask>=1.0.4,<3.1
Werkzeug<3.1
Flask>=1.0.4,<3.2
Werkzeug<3.2
plotly>=5.0.0
importlib-metadata
typing_extensions>=4.1.1
Expand Down
6 changes: 0 additions & 6 deletions tests/async_tests/test_async_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

import numpy as np
import werkzeug

from dash_test_components import (
AsyncComponent,
Expand Down Expand Up @@ -316,11 +315,6 @@ async def set_out(opts):
dash_duo.select_dcc_dropdown("#dd", f"opt{i}")


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
@pytest.mark.parametrize("refresh", [False, True])
def test_async_cbsc007_parallel_updates(refresh, dash_duo):
# This is a funny case, that seems to mostly happen with dcc.Location
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/callbacks/test_basic_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import time

import numpy as np
import werkzeug

from dash_test_components import (
AsyncComponent,
Expand Down Expand Up @@ -305,11 +304,6 @@ def set_out(opts):
dash_duo.select_dcc_dropdown("#dd", "opt{}".format(i))


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
@pytest.mark.parametrize("refresh", [False, True])
def test_cbsc007_parallel_updates(refresh, dash_duo):
# This is a funny case, that seems to mostly happen with dcc.Location
Expand Down