-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PrettyTables.jl as HTML backend #3096
Conversation
I will post some screenshots obtained in Jupiter. It would be nice if someone can pass interesting cases to check if I missed something: The alignment follows the same behavior of text output without the
The only part I am really not happy with is the header cell title. DataFrames uses the Another thing we must discuss is how we will select the maximum number of rows and columns that will be rendered. @bkamins mentioned about using a env variable. In this PR, I just copied what we had before. |
@ronisbr - to test this I understand we should:
? |
Hi @bkamins ! Yes! Everything should work after those two steps. |
By the way, I was thinking in changing the maximum number of rows and columns to get the values in |
This is exactly my thinking. And I would set some reasonable defaults when they are not present, but let us wait for @nalimilan to comment on this. |
Ok! I can do this in this PR right now just to make it easier to test the cropping (it is somewhat different from what we have today and it was what lead to the most problems when adding features to PrettyTables :D). If we decided a different solution, I can remove it. |
OK |
This is related to discussion at JuliaLang/IJulia.jl#1040. Currently we use |
Right. The reason is as follows:
So, since DataFrames.jl is lower in precedence than Base Julia we cannot change the default |
One important comment: I could not test in Pluto! It seems that when we add |
I wondered why I was taking almost 4 minutes to show the first
takes almost 4s to run the first time. Whereas this code:
takes less than 2s. Given this, I am happy with the current state inside PrettyTables.jll, and I think I can remove the draft from this PR! Of course I need to update the tests, but we need to decide somethings before that. |
What feels weird to me is that data frames and matrices are very similar objects when it comes to printing. In theory you could also scroll horizontally if the matrix doesn't fit the screen, and it would arguably be more useful than plain truncation. This probably doesn't apply to all objects, but it sounds like a more general issue than just tables. Maybe it should be called something like |
They conceptually are, but they are not in implementation, as matrices do not support Regarding the name then indeed something like |
You mean that this PR fails under Pluto.jl? I understand this is a general PrettyTables.jl issue - right? |
Yeah, but shouldn't such a method exist ideally? |
But it should be in Base Julia (same for LaTeX) |
Actually no. Pluto.jl does some customization if the class in |
@fonsp - could you please comment how you see this (I it would be good to keep this PR and Pluto.jl in sync). Thank you! |
@ronisbr - fonsp/Pluto.jl#2206 was tagged, but I get no response from Pluto.jl maintainers what we should do. Do you think that the current design is "robust enough" that we can go ahead (i.e. the display in Pluto will be different, but it still will be nice and readable) or should we wait (i.e. things in Pluto.jl will not be nice so it is better to synchronize them before releasing)? CC @fonsp |
Hi @bkamins ! In my tests, I saw no problem. However, if you want, we can change the class name to something like |
Maybe you have a print screen what are the consequences of the current customization in Pluto? |
Sure! I will post it tonight. |
This is the default view (notice that this cropping is not added by PrettyTables.jl): I think Pluto sets Another thing is that the column alignment is not the same as selected by PrettyTables.jl. We are aligning numbers to the right (to keep consistency with text backend), but here the are aligned to the left. |
So it seems Pluto.jl just has a custom way of showing things end-2-end, so probably we can just let them do what they want. I understand current settings (i.e. using the same class name as they use) achieves this? |
Yes, it seems it overrides everything. However, I will keep testing as we modified this PR to check if some new setting breaks Pluto. |
Co-authored-by: Milan Bouchet-Valat <[email protected]>
Co-authored-by: Milan Bouchet-Valat <[email protected]>
7d6d3ba
to
5ca32f1
Compare
Hi @bkamins and @nalimilan IIUC:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Let us wait for @nalimilan. I just left one small request for tests.
After this is merged it would be super nice if you wrote a section to the manual about pretty printing (it does not have to be long - just something to get started with most important and non-obvious things; later it can be expanded based on users' feedback).
Thank you!
#3172 might help the CI failure for Julia 1 - windows-latest - x86? |
Hi @bkamins and @nalimilan ! Done, I think I implemented all the requested changes. |
oops, I forgot to include a line in the previous commit. |
@nalimilan - OK to merge now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Thank you all! |
@ronisbr - if you have time having a PR with a short tutorial on printing added to the manual before the DataFrames.jl 1.4 release would be great (no pressure of course). |
In the "User Guide" section. I would put it after "Working with DataFrames" and before "Importing ..." Thank you! |
Hi!
I am submitting the initial version of the code that makes DataFrames.jl uses PrettyTables.jl as HTML backend.
I need features that are not released in PrettyTables.jl yet. Hence, I propose the following workflow: