diff --git a/packages/reflex-components-core/news/+datadisplay-stale-lazy-exports.bugfix.md b/packages/reflex-components-core/news/+datadisplay-stale-lazy-exports.bugfix.md new file mode 100644 index 00000000000..4f36968187d --- /dev/null +++ b/packages/reflex-components-core/news/+datadisplay-stale-lazy-exports.bugfix.md @@ -0,0 +1 @@ +`reflex_components_core.datadisplay` no longer advertises `code_block`, `data_editor` and friends: those moved to the standalone `reflex-components-code` and `reflex-components-dataeditor` packages, so accessing them here raised `ModuleNotFoundError`. Reach them as before via `rx.code_block` / `rx.data_editor`, or `reflex.components.datadisplay.code`. diff --git a/packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.py b/packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.py index ed58e667da1..cfbcf83ad7e 100644 --- a/packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.py +++ b/packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.py @@ -4,13 +4,10 @@ from reflex_base.utils import lazy_loader +# `code_block` and `data_editor` ship as the standalone reflex-components-code +# and reflex-components-dataeditor packages, which `reflex.components.datadisplay` +# maps onto. _SUBMOD_ATTRS: dict[str, list[str]] = { - "code": [ - "CodeBlock", - "code_block", - "LiteralCodeLanguage", - ], - "dataeditor": ["data_editor", "data_editor_theme", "DataEditorTheme"], "logo": ["logo"], } diff --git a/pyi_hashes.json b/pyi_hashes.json index 603fc724e48..7b2d5dfd55b 100644 --- a/pyi_hashes.json +++ b/pyi_hashes.json @@ -22,7 +22,7 @@ "packages/reflex-components-core/src/reflex_components_core/core/sticky.pyi": "a910d65f42f620531c959677d22977cb", "packages/reflex-components-core/src/reflex_components_core/core/upload.pyi": "d903297d188fe6fe56a824127e0db925", "packages/reflex-components-core/src/reflex_components_core/core/window_events.pyi": "3e39f7b3282570da5d2d3ac503d1f278", - "packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.pyi": "f46edcf2c5bd4b80894b4d0f623e059b", + "packages/reflex-components-core/src/reflex_components_core/datadisplay/__init__.pyi": "fd3cea1f1a221ed3404c28ec4fec7b3c", "packages/reflex-components-core/src/reflex_components_core/el/__init__.pyi": "ca9bfe7ba432aa47d982a144ef374126", "packages/reflex-components-core/src/reflex_components_core/el/element.pyi": "930b020d7c933ab0e29ba7971ba1abd2", "packages/reflex-components-core/src/reflex_components_core/el/elements/__init__.pyi": "ded6fc0acc37c9260da5cfd5f4309079", diff --git a/tests/units/reflex_components_core/datadisplay/__init__.py b/tests/units/reflex_components_core/datadisplay/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/units/reflex_components_core/datadisplay/test_init.py b/tests/units/reflex_components_core/datadisplay/test_init.py new file mode 100644 index 00000000000..5d4fa5446ac --- /dev/null +++ b/tests/units/reflex_components_core/datadisplay/test_init.py @@ -0,0 +1,24 @@ +"""Tests for the lazily loaded reflex_components_core.datadisplay namespace.""" + +import importlib + +import pytest +import reflex_components_core.datadisplay as datadisplay + + +@pytest.mark.parametrize("name", datadisplay.__all__) +def test_lazy_attribute_resolves(name: str): + """Every exported name must actually be importable.""" + assert getattr(datadisplay, name) is not None + + +@pytest.mark.parametrize( + ("module", "name"), + [ + ("reflex.components.datadisplay.code", "code_block"), + ("reflex.components.datadisplay.dataeditor", "data_editor"), + ], +) +def test_split_out_components_still_reachable(module: str, name: str): + """The components that moved out keep working through reflex.components.""" + assert getattr(importlib.import_module(module), name) is not None