diff --git a/CHANGELOG.md b/CHANGELOG.md index b014c4fbb2..19bcb91dad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.11.0] - Unreleased +### Changed + +- Breaking change: `TreeNode` can no longer be imported from `textual.widgets`; it is now available via `from textual.widgets.tree import TreeNode`. https://github.com/Textualize/textual/pull/1637 + ### Fixed - Fixed stuck screen https://github.com/Textualize/textual/issues/1632 diff --git a/examples/json_tree.py b/examples/json_tree.py index 7380fcc25a..45cede3c54 100644 --- a/examples/json_tree.py +++ b/examples/json_tree.py @@ -4,7 +4,8 @@ from rich.text import Text from textual.app import App, ComposeResult -from textual.widgets import Header, Footer, Tree, TreeNode +from textual.widgets import Header, Footer, Tree +from textual.widgets.tree import TreeNode class TreeApp(App): diff --git a/src/textual/widgets/__init__.py b/src/textual/widgets/__init__.py index 4628cbe922..295b8bf122 100644 --- a/src/textual/widgets/__init__.py +++ b/src/textual/widgets/__init__.py @@ -23,7 +23,6 @@ from ._static import Static from ._text_log import TextLog from ._tree import Tree - from ._tree_node import TreeNode from ._welcome import Welcome from ..widget import Widget @@ -44,7 +43,6 @@ "Static", "TextLog", "Tree", - "TreeNode", "Welcome", ] diff --git a/src/textual/widgets/_tree_node.py b/src/textual/widgets/_tree_node.py deleted file mode 100644 index e6c57fb617..0000000000 --- a/src/textual/widgets/_tree_node.py +++ /dev/null @@ -1 +0,0 @@ -from ._tree import TreeNode as TreeNode diff --git a/src/textual/widgets/data_table.py b/src/textual/widgets/data_table.py new file mode 100644 index 0000000000..d0316f3872 --- /dev/null +++ b/src/textual/widgets/data_table.py @@ -0,0 +1,5 @@ +"""Make non-widget DataTable support classes available.""" + +from ._data_table import Column, Row + +__all__ = ["Column", "Row"] diff --git a/src/textual/widgets/tree.py b/src/textual/widgets/tree.py new file mode 100644 index 0000000000..2e315bc23d --- /dev/null +++ b/src/textual/widgets/tree.py @@ -0,0 +1,5 @@ +"""Make non-widget Tree support classes available.""" + +from ._tree import TreeNode + +__all__ = ["TreeNode"] diff --git a/tests/tree/test_tree_node_children.py b/tests/tree/test_tree_node_children.py index eb5c949c07..d6c5c7e4e6 100644 --- a/tests/tree/test_tree_node_children.py +++ b/tests/tree/test_tree_node_children.py @@ -1,5 +1,6 @@ import pytest -from textual.widgets import Tree, TreeNode +from textual.widgets import Tree +from textual.widgets.tree import TreeNode def label_of(node: TreeNode[None]): diff --git a/tests/tree/test_tree_node_label.py b/tests/tree/test_tree_node_label.py index e64fcf24d9..7d7a043291 100644 --- a/tests/tree/test_tree_node_label.py +++ b/tests/tree/test_tree_node_label.py @@ -1,4 +1,5 @@ -from textual.widgets import Tree, TreeNode +from textual.widgets import Tree +from textual.widgets.tree import TreeNode from rich.text import Text diff --git a/tests/tree/test_tree_node_parent.py b/tests/tree/test_tree_node_parent.py index b9d85af432..87e66ebc4b 100644 --- a/tests/tree/test_tree_node_parent.py +++ b/tests/tree/test_tree_node_parent.py @@ -1,4 +1,4 @@ -from textual.widgets import TreeNode, Tree +from textual.widgets import Tree def test_tree_node_parent() -> None: