# \[ANN\] PrettyTables.jl v0.9.0 - Breaking release, please read

**URL:** <https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538>\
**Category:** Package Announcements\
**Created:** [April 14, 2020, 12:26am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538 "2020-04-14T00:26:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 14, 2020, 12:26am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538/1 "2020-04-14T00:26:12Z")

</div>

Hi!

I have just tagged a new release of [PrettyTables.jl](https://github.com/ronisbr/PrettyTables.jl) - it should be registered soon. This modifies a lot of things and, unfortunately, breaks a lot of things… This was necessary because the package became much bigger than I thought initially. Thus, I had to improve the consistency by throwing away bad choices 😊

The entire changelog is:

- The table format of the text back-end now has the variable `vlines` which defines the vertical lines that should be drawn by default. In this case, the variables `left_border` and `right_border` were removed because they were not necessary anymore.
- The compatibility with [Tables.jl](https://github.com/JuliaData/Tables.jl) API was improved. Now, tables without a schema can be printed. Furthermore, if a table has a schema but the user pass a header, then the user’s header will be used instead. Thus, this can be breaking. (Issue [#45][gh-issue-45])
- The behavior of the keyword `hlines` was modified in text back-end. Now, it can be used to draw **any** horizontal line, including the bottom, header, and top lines. A variable also named `hlines` was added to the structure `TextFormat` to defined which horizontal lines should be drawn by default. Thus, the variables `top_line`, `header_line`, and `bottom_line` of the same structure were removed since they were not necessary anymore. Furthermore, the old behavior of `hlines` and `hlines_format` can be replicated in this version using `body_hlines` and `body_hlines_format`, respectively.
- The vertical lines behavior in LaTeX back-end was modified to match the behavior selected for the text back-end. Thus, the keyword `row_number_vline` was removed, since it was not necessary anymore.
- The API of formatters was drastically change to improve the consistency of the package. Now, as we have in `highlighters`, the formatters are composed of a function or a tuple of functions with the signature `f(value,i,j)`, where `value` is the cell value that must be formatted, `i` is the row number, and `j` is the column number. These function must return the formatted value for the cell `(i,j)`. Since it is now possible to define multiple formatters, the keyword name was changed from `formatter` to `formatters`. The old API still works, but it marked as deprecated.
- The vertical lines in text back-end can now be controlled by the keyword `vlines`. (Issue [#46][gh-issue-46])
- The option `row_names` can be used to append a column to the left of the table with the names of the columns.
- The `highlighters` format of text back-end was improved. The user can now create highlighters that will dynamically apply `crayons` depending on the data value and the cell coordinate, as it was possible with the LaTeX and HTML back-ends.
- The API of `cell_alignment` was changed to improve the consistency of the package. Now, as we have in `highlighters`, the `cell_alignment` must be a function or a tuple of functions with the signature `f(data,i,j)`, where `data` is the matrix that is being printed, `i` is the row number, and `j` is the column number. These function must return the alignment symbol for the cell `(i,j)`. For convenience, the old API using dictionaries is still available for the simple cases.
- End of support of Julia 1.3. The supported versions are 1.0 and 1.4.

Thus, with this new version, it is very easy to format table lines in text backend. I saw a lot of people creating custom formats just to remove a line, which seems bad. Thus, let’s say you want to print something without any horizontal line:

```julia
julia> data = ["Set 1" 1 2 3 4 5
               "Set 2" 3 4 5 2 5
               "Set 3" 5 6 8 1 2];

julia> pretty_table(data, ["Set" "1st" "2nd" "3rd" "4th" "5th"], hlines = :none)
│ Set │ 1st │ 2nd │ 3rd │ 4th │ 5th │
│ Set 1 │ 1 │ 2 │ 3 │ 4 │ 5 │
│ Set 2 │ 3 │ 4 │ 5 │ 2 │ 5 │
│ Set 3 │ 5 │ 6 │ 8 │ 1 │ 2 │

```

Or, maybe, with just the header line:

```julia
julia> pretty_table(data, ["Set" "1st" "2nd" "3rd" "4th" "5th"], hlines = [:header])
│ Set │ 1st │ 2nd │ 3rd │ 4th │ 5th │
├───────┼─────┼─────┼─────┼─────┼─────┤
│ Set 1 │ 1 │ 2 │ 3 │ 4 │ 5 │
│ Set 2 │ 3 │ 4 │ 5 │ 2 │ 5 │
│ Set 3 │ 5 │ 6 │ 8 │ 1 │ 2 │

```

The same can be done for the vertical lines:

```julia
julia> pretty_table(data, ["Set" "1st" "2nd" "3rd" "4th" "5th"], hlines = [:header], vlines = :none)
   Set 1st 2nd 3rd 4th 5th
──────────────────────────────────────
 Set 1 1 2 3 4 5
 Set 2 3 4 5 2 5
 Set 3 5 6 8 1 2

julia> pretty_table(data, ["Set" "1st" "2nd" "3rd" "4th" "5th"], hlines = [:header], vlines = [:begin,1,:end])
│ Set │ 1st 2nd 3rd 4th 5th │
├───────┼─────────────────────────────┤
│ Set 1 │ 1 2 3 4 5 │
│ Set 2 │ 3 4 5 2 5 │
│ Set 3 │ 5 6 8 1 2 │

```

The highlighters in text back-end can now be dynamically selected based on the data set. Hence, we can now select the text color based on the cell value. Using the package [ColorScheme.jl](https://github.com/JuliaGraphics/ColorSchemes.jl), it is now possible to do this:

```julia
julia> using PrettyTables

julia> using ColorSchemes

julia> data = [sind(x)*cosd(y) for x in 0:10:180, y in 0:10:180]

julia> hl = Highlighter((data,i,j)->true,
                        (h,data,i,j)->begin
                             color = get(colorschemes[:coolwarm], data[i,j], (-1,1))
                             return Crayon(foreground = (round(Int,color.r*255),
                                                         round(Int,color.g*255),
                                                         round(Int,color.b*255)))
                         end)

julia> pretty_table(data, ["x = $(x)°" for x = 0:10:180],
                    row_names = ["y = $(y)°" for y = 0:10:180],
                    highlighters = hl,
                    formatters = ft_printf("%.2f"))

```

 ![ex_00015](https://global.discourse-cdn.com/julialang/original/3X/0/7/0748861487a77dc46564c88f1f6d787763acf331.png)

(For this case, your terminal must support 24bit colors!)

---

<div class="post-metadata">

**Author:** ![shorty66](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shorty66/32/3254_2.png) [@shorty66](https://discourse.julialang.org/u/shorty66)\
**Post date:** [April 14, 2020, 7:49am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538/2 "2020-04-14T07:49:24Z")

</div>

Your first link to the package leads nowhere. Did you mean to link this URL [https://github.com/ronisbr/PrettyTables.jl](https://github.com/ronisbr/PrettyTables.jl)?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 14, 2020, 11:35am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538/3 "2020-04-14T11:35:35Z")

</div>

Yes! Thanks, I will edit 🙂

---

<div class="post-metadata">

**Author:** ![Zach\_Christensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zach_christensen/32/7220_2.png) [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Post date:** [April 15, 2020, 12:18am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538/4 "2020-04-15T00:18:41Z")

</div>

Thanks @Ronis_BR for this truly great package. For those who are unaware, some of these changes were things that I was specifically requesting. My requests received generous attention. I’m excited to see how this package continues to integrate into various parts of the Julia ecosystem.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [April 15, 2020, 4:05am UTC](https://discourse.julialang.org/t/ann-prettytables-jl-v0-9-0-breaking-release-please-read/37538/5 "2020-04-15T04:05:23Z")

</div>

Thanks for the kind words 🙂 I am glad it is being useful!
