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

Extend describe from DataAPI to allow removing StatsBase dependency #1818

Merged
merged 2 commits into from
Jul 17, 2019

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented May 24, 2019

No description provided.

@@ -1323,24 +1323,6 @@ macro tsv_str(s, flags...)
inlinetable(s, flags...; separator='\t')
end

@deprecate showcols(df::AbstractDataFrame, all::Bool=false, values::Bool=true) describe(df, :eltype, :nmissing, :first, :last)
@deprecate showcols(io::IO, df::AbstractDataFrame, all::Bool=false, values::Bool=true) show(io, describe(df, :eltype, :nmissing, :first, :last), all)
function StatsBase.describe(df::AbstractDataFrame; stats=nothing)
Copy link
Member

Choose a reason for hiding this comment

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

@quinnj Thank you for the PR. It will make our life easier. The only thing I would change is leave this deprecation in line 1328 to stick for some longer time as it was introduced very recently, so some old user code might rely on it.

Copy link
Member

Choose a reason for hiding this comment

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

@quinnj Please add back these deprecations. I see no reason to remove these, especially showcols which is likely to appear in old blog posts here and there.

Copy link
Member

Choose a reason for hiding this comment

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

I have accepted this because the deprecations were "deprecated" long enough (but @nalimilan - I know your policy so if you really think we should revert I am OK with this). Thank you for such a careful consideration of things.

Copy link
Member

Choose a reason for hiding this comment

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

These don't cost us anything so I don't see the point of removing them...

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's a good policy to just keep deprecations around because they're "cheap". That leads to users disregarding deprecations because they might think the functionality will stick around forever anyway; or even worse, they won't know what is a "real" deprecation vs. something we're just trying to fade out. These deprecations have been in multiple minor releases at this point, so I see no reason to keep them around.

Copy link
Member

Choose a reason for hiding this comment

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

Deprecations are so verbose that I really doubt users will keep using them instead of the replacement. All our deprecations are "real" and I think we've been quite clear about that. But note that there are books around that use the old APIs and we haven't even tagged a real major release, so keeping deprecations is really the minimum we can do to respect our users.

Copy link
Member Author

Choose a reason for hiding this comment

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

We're still pre-1.0, so each minor release is like a major release.

Copy link
Member

Choose a reason for hiding this comment

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

Technically yes, but they happen much more frequently than real major releases, and they aren't really advertized.

@@ -7,7 +7,8 @@ module DataFrames
##############################################################################

using Statistics, Printf, REPL
using Reexport, StatsBase, SortingAlgorithms, Compat, Unicode, PooledArrays
using Reexport, SortingAlgorithms, Compat, Unicode, PooledArrays
using DataAPI
Copy link
Member

Choose a reason for hiding this comment

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

Add this to previous line?

src/DataFrames.jl Outdated Show resolved Hide resolved
@quinnj quinnj marked this pull request as ready for review July 17, 2019 05:17
@quinnj
Copy link
Member Author

quinnj commented Jul 17, 2019

Alright, rebased the PR here. Tests looked good locally, though I ran into a test/indexing crash on the Julia 1.2-rc2 (reported JuliaLang/julia#32607)

@bkamins
Copy link
Member

bkamins commented Jul 17, 2019

Thank you - I will have a detailed look at it soon.

Additionally it seems that tests also still try to reference StatsBase.jl (not sure why - probably we use some function from it for testing purposes).

@bkamins
Copy link
Member

bkamins commented Jul 17, 2019

@quinnj in test/utils.jl you can remove Statistics, StatsBase, Random from using in line 3 (https://github.com/JuliaData/DataFrames.jl/blob/master/test/utils.jl#L3). They are not used (only Test and DataFrames need to be imported).

@bkamins
Copy link
Member

bkamins commented Jul 17, 2019

Also - if I remember things correctly DataAPI does not export describe so instead of re-exporting DataAPI we should export describe from it. Right?

@quinnj
Copy link
Member Author

quinnj commented Jul 17, 2019

Updated test/utils.jl. DataAPI has a policy to specifically not export any functions, relying on extending packages to do so. Here, we're just exporting describe (after importing it, so really, we're exporting the DataAPI.describe function), which should ensure no breakage.

```

"""
StatsBase.describe(df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...) =
DataAPI.describe(io::IO, df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...) =
Copy link
Member

Choose a reason for hiding this comment

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

Do we have to quality here and below with DataAPI. prefix? I think it can be omitted. Right?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can omit, but I personally like to always explicitly qualify, just to be explicit about where this method is being defined.

Copy link
Member

@bkamins bkamins left a comment

Choose a reason for hiding this comment

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

Thank you. Looks good to me. I have not noticed earlier that we already exported describe in the old code that did not need changing (I thought we re-exported it).

I have left one small comment about code style.

@quinnj quinnj merged commit e204709 into master Jul 17, 2019
@quinnj quinnj deleted the jq/dataapi branch July 17, 2019 16:06
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.

None yet

3 participants