Skip to content
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

Add DataAPI as a dependency to share describe with other packages #496

Merged
merged 3 commits into from
Jul 17, 2019

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented May 24, 2019

No description provided.

@@ -648,12 +648,12 @@ Pretty-print the summary statistics provided by [`summarystats`](@ref):
the mean, minimum, 25th percentile, median, 75th percentile, and
maximum.
"""
describe(a::AbstractArray) = describe(stdout, a)
function describe(io::IO, a::AbstractArray{T}) where T<:Union{Real,Missing}
DataAPI.describe(x) = describe(stdout, x)
Copy link
Member

Choose a reason for hiding this comment

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

We should reexport describe to avoid breaking any packages which may be overloading it from StatsBase.

@quinnj quinnj marked this pull request as ready for review July 17, 2019 05:22
@quinnj
Copy link
Member Author

quinnj commented Jul 17, 2019

Alright, now that DataAPI.jl is registered, I've updated the PR here.

@quinnj
Copy link
Member Author

quinnj commented Jul 17, 2019

Errors are just 0.7 staleness; should we remove that from testing?

@@ -648,12 +648,12 @@ Pretty-print the summary statistics provided by [`summarystats`](@ref):
the mean, minimum, 25th percentile, median, 75th percentile, and
maximum.
"""
describe(a::AbstractArray) = describe(stdout, a)
function describe(io::IO, a::AbstractArray{T}) where T<:Union{Real,Missing}
DataAPI.describe(x) = describe(stdout, x)
Copy link
Contributor

Choose a reason for hiding this comment

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

This catch-all definition is a type-piracy kind. It is duplicated in DataFrames.jl for a specific case.
Maybe we should define one-argument version in DataAPI.jl instead as this will be the default everywhere I think (at least when someone loads StatsBase.jl it will be anyway)?

Also since we import describe, qualifying it with DataAPI. is not strictly needed (but I am not sure what is a better style to use here).

Copy link
Member Author

Choose a reason for hiding this comment

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

So the "type piracy" is explicitly allowed here since DataAPI.jl affirms that StatsBase "owns" this function and provides the default fallback. I agree it may make sense to define this particular fallback in DataAPI, but I also don't think it really matters for DataFrames, since it defines its own describe like describe(x, stat), so it naturally makes sense that it should also define describe(df, stat) = describe(stdout, df, stat) (which is currently does in my PR).

So overall, I understand where you're coming from, but I also worked around in circles a bit here before deciding the current setup should be good (given that StatsBase "owns" describe, which means in general, users who want describe should load StatsBase themselves).

Copy link
Contributor

Choose a reason for hiding this comment

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

OK - agreed.

@ararslan
Copy link
Member

Errors are just 0.7 staleness; should we remove that from testing?

I'd just drop 0.7 altogether. No reason to support it at this point, IMO.

@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

Merging #496 into master will increase coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #496      +/-   ##
==========================================
+ Coverage   90.07%   90.15%   +0.07%     
==========================================
  Files          21       21              
  Lines        2026     2022       -4     
==========================================
- Hits         1825     1823       -2     
+ Misses        201      199       -2
Impacted Files Coverage Δ
src/StatsBase.jl 100% <ø> (ø) ⬆️
src/scalarstats.jl 97.14% <0%> (+0.91%) ⬆️
src/hist.jl 91% <0%> (-0.05%) ⬇️
src/moments.jl 99.31% <0%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fde3142...2e91d37. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

Merging #496 into master will increase coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #496      +/-   ##
==========================================
+ Coverage   90.07%   90.15%   +0.07%     
==========================================
  Files          21       21              
  Lines        2026     2022       -4     
==========================================
- Hits         1825     1823       -2     
+ Misses        201      199       -2
Impacted Files Coverage Δ
src/StatsBase.jl 100% <ø> (ø) ⬆️
src/scalarstats.jl 97.14% <0%> (+0.91%) ⬆️
src/hist.jl 91% <0%> (-0.05%) ⬇️
src/moments.jl 99.31% <0%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fde3142...2e91d37. Read the comment docs.

@quinnj quinnj merged commit b9454f9 into master Jul 17, 2019
@quinnj quinnj deleted the jq/dataapi branch July 17, 2019 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants