kosiew opened a new pull request, #1100: URL: https://github.com/apache/datafusion-python/pull/1100
# Which issue does this PR close? Closes #1096. # Rationale for this change This PR introduces a flexible and customizable HTML rendering mechanism for DataFusion DataFrames in the Python API. The existing `_repr_html_` method was hardcoded and inflexible. By refactoring to use a dedicated HTML formatter, we gain modularity, customization options, and testability, improving the user experience especially in notebook environments. # What changes are included in this PR? - Added `datafusion/html_formatter.py`: - `DataFrameHtmlFormatter` class - `StyleProvider` and `CellFormatter` protocols for customization - Global configuration via `configure_formatter`, `get_formatter`, `reset_formatter` - Expandable cell rendering with embedded JavaScript - Refactored `PyDataFrame._repr_html_()` to delegate to the Python HTML formatter - Updated `__init__.py` to expose `configure_formatter` - Added extensive tests: - Style configuration and override - Type-based formatting - Custom header and cell rendering - Style-sharing logic across renders # Are there any user-facing changes? ✅ Yes. Users can now: - Customize how DataFrames render in Jupyter notebooks - Use custom styling, formatters, and rendering behavior - Control expand/collapse behavior for long cell values - Use `configure_formatter()` to globally control output formatting Documentation should be updated to include usage examples of the HTML formatter (e.g., in the Python API docs or notebook examples). <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org