Skip to content

[tabulate] Accept dataclass rows and None in maxheadercolwidths - #16821

Open
hemtilva wants to merge 1 commit into
python:mainfrom
hemtilva:tabulate-dataclass-rows
Open

hemtilva wants to merge 1 commit into
python:mainfrom
hemtilva:tabulate-dataclass-rows

Conversation

@hemtilva

Copy link
Copy Markdown
Contributor

Fixes #16819

  • tabular_data now also accepts Iterable[DataclassInstance]. The tabulate() docstring lists "an iterable of dataclasses" as supported, and it works on 0.10.0.
  • maxheadercolwidths is now int | Iterable[int | None] | None, the same as maxcolwidths. Both are handled the same way at runtime, with None meaning no limit for that column.

mypy --strict on the snippet in the issue goes from two errors to none, and mypy on stubs/tabulate is clean. #16730 and #16731 touch the same tabular_data line for DataFrame support, so whichever lands second will need a one-line rebase.

I used Claude to help find this and write the change.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 05:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tabulate] dataclass rows and None in maxheadercolwidths are rejected

2 participants