Current state and the future of PrettyTables.jl

Thank you @Ronis_BR ! No rush. Hope you can solve these problemsπŸ™πŸΌ

6 Likes

Thanks!!

1 Like

Hope you can solve your problems soon! If it cheers you up, you should know that this package has massively helped a lot of people.

13 Likes

Thanks!!

Hi @Ronis_BR,
I hope your problems will be solved soon!

I am currently implementing PrettyTables into GenieFramework and I am about to define the following struct type that contains both the data and the configuration.

mutable struct PrettyTable{T}
    data::T
    conf::PrettyTablesConf
end

PrettyTable(data) = PrettyTable(data, PrettyTablesConf())

PrettyTables.pretty_table(@nospecialize(pt::PrettyTable); kwargs...) = pretty_table_with_conf(pt.conf, pt.data; kwargs...)
PrettyTables.pretty_table(@nospecialize(io_or_String), @nospecialize(pt::PrettyTable); kwargs...) = pretty_table_with_conf(pt.conf, pt.data; kwargs...)

Do you think it is reasonable to make that definition part of your package? Other frameworks might also benefit.

If so, I’d be happy to provide a PR including docs and tests.

Hi @hhaensel !

I think it will be very nice. Indeed, there was a lot of request for this. However, maybe it is better to wait for the rewrite because I am changing a lot of things (check the v3 branch).

2 Likes

Will do

1 Like

Had a look into v3 and started a PR add mutable struct `PrettyTable` to comprise data, backend and config by hhaensel Β· Pull Request #257 Β· ronisbr/PrettyTables.jl Β· GitHub

2 Likes

Thanks! I will take a look as soon as possible!

3 Likes

Hi everyone!

Just a small update, after a lot of life stuff, I will be able to resume the work in PrettyTables.jl :slight_smile: I hope to have some news during this weekend!

43 Likes

Oh no! I use this all the time. Nothing easier to work with tables. Please keep it!

1 Like

Hi @Jerry !

Can you please detail your use case? I am really trying to keep the features at a minimum to make easier to maintain PrettyTables.jl.

1 Like

Hi Ronis_BR. Can I expect a little more compactness between columns? Currently, there is a minimum of 3 spaces between columns.

Hi @karei!

If you remove all vertical lines, you can have two spaces between the columns:

julia> A = rand(3, 3)
3Γ—3 Matrix{Float64}:
 0.488513   0.304572  0.29507
 0.0225261  0.402398  0.941425
 0.203874   0.570825  0.254407

julia> pretty_table(A; table_format = TextTableFormat(; @text__no_vertical_lines))
───────────────────────────────
    Col. 1    Col. 2    Col. 3
───────────────────────────────
  0.488513  0.304572   0.29507
 0.0225261  0.402398  0.941425
  0.203874  0.570825  0.254407
───────────────────────────────
1 Like

By the way, one very nice feature added to the v3 branch, which was created by @hhaensel, is the definition of the type PrettyTable. This was something that many people had asked for, but I had been hesitant to add it because PrettyTables.jl should primarily be a backend for printing tables, not a tool for defining objects. However, it turns out that we can use this new object to construct the table in a more bottom-up manner and also provide an object that can be used to overload printing in many cases.

julia> using PrettyTables

julia> pt = PrettyTable(rand(3,3))
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Col. 1 β”‚   Col. 2 β”‚   Col. 3 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0.898637 β”‚ 0.611356 β”‚ 0.399206 β”‚
β”‚ 0.990356 β”‚  0.98928 β”‚ 0.959873 β”‚
β”‚ 0.798757 β”‚ 0.991781 β”‚ 0.145727 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

julia> pt.table_format = TextTableFormat(; @text__no_vertical_lines)
TextTableFormat(TextTableBorders('┐', 'β”Œ', 'β””', 'β”˜', '┬', 'β”œ', '─', 'β”Ό', 'β”΄', 'β”‚', '─'), true, :none, true, :none, true, true, true, true, false, false, false, :none, false, false, true, 0)

julia> pt
──────────────────────────────
   Col. 1    Col. 2    Col. 3
──────────────────────────────
 0.898637  0.611356  0.399206
 0.990356   0.98928  0.959873
 0.798757  0.991781  0.145727
──────────────────────────────

julia> pt.column_labels = ["Column 1", MultiColumn(2, "Merged Columns")]
2-element Vector{Any}:
 "Column 1"
 MultiColumn(2, "Merged Columns", :c)

julia> pt
──────────────────────────────
 Column 1    Merged Columns
──────────────────────────────
 0.898637  0.611356  0.399206
 0.990356   0.98928  0.959873
 0.798757  0.991781  0.145727
──────────────────────────────
21 Likes

Hi everyone!

I’ve finally pushed the version 3 of PrettyTables.jl to the master branch! While there’s still some documentation that I need to write, I believe we’re in a good position for everyone using the package to begin testing.

I anticipate breaking many things when I tag version 3. This is particularly concerning because DataFrames.jl will still be using version 2, and we cannot have two versions of the same package in use simultaneously. Therefore, I strongly believe that we should ensure a stable version 3 API before proceeding further.

Please, provide feedback here or in an issue in the repository!

20 Likes

@Jerry by the way, I decided to keep the stand_alone option in HTML, but with a simplified CSS style that is easier to maintain.

Great. Sorry for the late reply. I dump the table to a HTML file and have the same Julia program command Firefox to open the new file in a new tab. Maybe I’m not using PrettyTables right.

1 Like

Hi!

The migration of DataFrames.jl to the new API is happening very smoothly :slight_smile:

I decided to migrate the code in a local repository to check if features are missing.

16 Likes

I am reaching a very nice integration between DataFrames.jl! When the support is added, we will be able to summarize DataFrames very easily:

Maybe we can think about some deeper integration in DataFrames.jl so that it can use the new features in PrettyTables.jl.

30 Likes