diff --git a/dvc/command/experiments.py b/dvc/command/experiments.py index cdf388aaa..b8180a1c9 100644 --- a/dvc/command/experiments.py +++ b/dvc/command/experiments.py @@ -408,7 +408,9 @@ class CmdExperimentsShow(CmdBase): # NOTE: rich does not have native support for unlimited width # via pager. we override rich table compression by setting # console width to the full width of the table - measurement = table.__rich_measure__(console, SHOW_MAX_WIDTH) + console_options = console.options + console_options.max_width = SHOW_MAX_WIDTH + measurement = table.__rich_measure__(console, console_options) console._width = ( # pylint: disable=protected-access measurement.maximum ) diff --git a/dvc/utils/table.py b/dvc/utils/table.py index e3a84c00a..f6f15570c 100644 --- a/dvc/utils/table.py +++ b/dvc/utils/table.py @@ -8,6 +8,7 @@ from rich.table import Table as RichTable if TYPE_CHECKING: from rich.console import ( Console, + ConsoleOptions, JustifyMethod, OverflowMethod, RenderableType, @@ -56,7 +57,7 @@ class Table(RichTable): self.columns.append(column) def _calculate_column_widths( - self, console: "Console", max_width: int + self, console: "Console", options: "ConsoleOptions" ) -> List[int]: """Calculate the widths of each column, including padding, not including borders. @@ -64,7 +65,7 @@ class Table(RichTable): Adjacent collapsed columns will be removed until there is only a single truncated column remaining. """ - widths = super()._calculate_column_widths(console, max_width) + widths = super()._calculate_column_widths(console, options) last_collapsed = -1 columns = cast(List[Column], self.columns) for i in range(len(columns) - 1, -1, -1): @@ -73,14 +74,14 @@ class Table(RichTable): del widths[last_collapsed] del columns[last_collapsed] if self.box: - max_width += 1 + options.max_width += 1 for column in columns[last_collapsed:]: column._index -= 1 last_collapsed = i padding = self._get_padding_width(i) if ( columns[i].overflow == "ellipsis" - and (sum(widths) + padding) <= max_width + and (sum(widths) + padding) <= options.max_width ): # Set content width to 1 (plus padding) if we can fit a # single unicode ellipsis in this column diff --git a/setup.py b/setup.py index 8603f4346..965af1cff 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ install_requires = [ "pygtrie==2.3.2", "dpath>=2.0.1,<3", "shtab>=1.3.4,<2", - "rich>=9.0.0,<10", + "rich>=10.0.0", "dictdiffer>=0.8.1", "python-benedict>=0.21.1", "pyparsing==2.4.7",