Skip to content

Commit

Permalink
Use tf_borderless for PrettyTables >= 0.10 (#251)
Browse files Browse the repository at this point in the history
* Use `tf_borderless` on PrettyTables >= 0.10

* Add tests

* Bump version
  • Loading branch information
devmotion authored Nov 16, 2020
1 parent 128f7ff commit 58fbead
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "Chain types and utility functions for MCMC simulations."
version = "4.3.0"
version = "4.3.1"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
8 changes: 6 additions & 2 deletions src/summarize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function Base.show(io::IO, ::MIME"text/plain", df::ChainDataFrame)
formatter = PrettyTables.ft_printf("%.$(digits)f")

println(io, df.name)
PrettyTables.pretty_table(io, df.nt;
formatters = formatter, tf = PrettyTables.borderless)
# Support for PrettyTables 0.9 (`borderless`) and 0.10 (`tf_borderless`)
PrettyTables.pretty_table(
io, df.nt;
formatters = formatter,
tf = isdefined(PrettyTables, :borderless) ? PrettyTables.borderless : PrettyTables.tf_borderless,
)
end

Base.isequal(c1::ChainDataFrame, c2::ChainDataFrame) = isequal(c1, c2)
Expand Down
6 changes: 6 additions & 0 deletions test/summarize_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using Statistics: std

parm_df = summarize(chns, sections=[:parameters])

# check that display of ChainDataFrame does not error
println("compact display:")
show(stdout, parm_df)
println("\nverbose display:")
show(stdout, "text/plain", parm_df)

@test 0.48 < parm_df[:a, :mean][1] < 0.52
@test names(parm_df) == [:parameters, :mean, :std, :naive_se, :mcse, :ess, :rhat]

Expand Down

2 comments on commit 58fbead

@cpfiffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/24769

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.3.1 -m "<description of version>" 58fbeadf189d246b62675a4afe3551f1ee0ad668
git push origin v4.3.1

Please sign in to comment.