kosiew opened a new issue, #1096:
URL: https://github.com/apache/datafusion-python/issues/1096

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   
   The current `_repr_html_` implementation in `dataframe.rs` embeds HTML 
rendering logic directly in Rust. This design tightly couples the rendering 
logic with the DataFrame internals, making it difficult to customize the output 
or apply different styling rules. 
   This results in inflexibility for users who wish to tailor the HTML output 
for their environment or disable it entirely.
   
   
   **Describe the solution you'd like**
   A clear and concise description of what you want to happen.
   
   Introduce a configurable Python-based HTML formatter for DataFrame 
visualization, which includes the following components:
   - A new Python module `datafusion/html_formatter.py`
   - A `DataFrameHtmlFormatter` class responsible for rendering options such as 
cell truncation, CSS styling, and interactivity
   - A global formatter instance with an accessible configuration API
   
   The Rust-side `_repr_html_` will be modified to:
   - Convert record batches to PyArrow objects
   - Call the Python formatter
   - Return the resulting HTML for Jupyter or rich display contexts
   
   Users will be able to globally configure the formatter like so:
   
   ```python
   import datafusion as df
   
   df.configure_formatter(
       max_cell_length=50,
       enable_cell_expansion=False, 
       custom_css="table { font-family: Arial; }"
   )
   ```
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   - Continuing to manage HTML formatting logic in Rust, but this reduces 
flexibility and is harder to maintain
   
   - Using third-party libraries like pandas-style renderers, but this 
introduces dependency complexity and integration issues
   
   - Avoiding customization altogether, which limits user control and 
mismatches with modern expectations for interactive environments
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   
   This was motivated by @timsaucer 's [suggestion 
here](https://github.com/apache/datafusion-python/pull/1087#issuecomment-2780733705).
   
   This change aligns with a modular design philosophy, improves 
maintainability, and empowers users to better control their development 
experience. By decoupling visualization logic from Rust internals, it ensures 
better separation of concerns and enables easier integration with Python-based 
tools and environments.
   
   Open Questions:
   
   Should backward compatibility with the current rendering be maintained?
   
   What default styling options should be included out of the box?
   
   Should per-DataFrame styling overrides be supported in addition to global 
configuration?


-- 
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.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

Reply via email to