Skip to content

Commit ee9d199

Browse files
authored
Update to PrettyTables.jl v3 (#415)
* update pretty tables compat * re-add prettytables 3 * update version to match DataFrames * change kwarg
1 parent b71ea7a commit ee9d199

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
version:
13-
- '1.6'
13+
- '1.10'
1414
- '1.12'
15-
- 'nightly'
1615
os:
1716
- ubuntu-latest
1817
- macOS-latest

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Chain = "8be319e6-bccf-4806-a6f7-6fae938471bc"
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
88
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
99
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
10+
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
1011
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1112
TableMetadataTools = "9ce81f87-eacc-4366-bf80-b621a3098ee2"
1213

@@ -15,9 +16,10 @@ Chain = "0.5, 0.6, 1"
1516
DataFrames = "1"
1617
MacroTools = "0.5"
1718
OrderedCollections = "1"
19+
PrettyTables = "2, 3"
1820
Reexport = "0.2, 1"
19-
julia = "1.6"
2021
TableMetadataTools = "0.1"
22+
julia = "1.10"
2123

2224
[extras]
2325
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"

src/metadata.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,21 @@ function printlabels(df, cols=All(); unlabelled = true)
218218
end
219219
end
220220
t = DataFrame(Column = cs, Label = ls)
221-
pretty_table(t; show_subheader = false)
221+
_print_labels(t)
222222
return nothing
223223
end
224224

225+
# Support older PrettyTables for now
226+
# (Will change when DataFrames.jl drops support)
227+
# I can't just use keyword arguments provided by
228+
# DataFrames.jl because I like the lines of the default
229+
# printing
230+
@static if pkgversion(PrettyTables).major == 2
231+
_print_labels(t) = pretty_table(t; show_subheader = false)
232+
else
233+
_print_labels(t) = pretty_table(t; show_first_column_label_only = true)
234+
end
235+
225236
"""
226237
printnotes(df, cols = All(); unnoted = false)
227238

0 commit comments

Comments
 (0)