Fix Compat on master by updating walkdir#307
Conversation
|
We shouldn't deprecate |
|
I have an alternative approach here: https://github.com/TotalVerb/Compat.jl/commit/8f6d272edd06f845fbab66f9d138027fa3622186 This will deprecate |
|
I'm not completely sure about what is the right solution here but |
|
There may be packages that still support 0.4 and 0.5, and have yet to upgrade to 0.6. Compat should not break these packages or add deprecation warnings to them until Compat drops support for those versions. (Part of a point of a stable release, like 0.4/0.5, is to not have code suddenly give deprecation warnings. Other packages do deprecate things all the time, but Compat should be extra careful.) That this feature is deprecated in Julia 0.6 means that we should deprecate it for Julia 0.6, but not 0.5 or earlier. |
| export walkdir | ||
|
|
||
| if VERSION < v"0.6.0-dev.2043" | ||
| function walkdir(root; topdown=true, follow_symlinks=false, onerror=throw) |
There was a problem hiding this comment.
should document that walkdir should be used as Compat.walkdir on 0.5
There was a problem hiding this comment.
why doesn't the base walkdir work on 0.5?
There was a problem hiding this comment.
you can't take! from a Task, so the two walkdirs are not compatible
| export pipeline | ||
| end | ||
|
|
||
| if VERSION < v"0.5.0-dev+961" |
There was a problem hiding this comment.
should still export walkdir on 0.4
There was a problem hiding this comment.
isn't the semantic change breaking for anyone using this on 0.4?
There was a problem hiding this comment.
Yes, any code using consume(walkdir(...)) will break. I don't know how to address this without keeping around two versions of walkdir.
There was a problem hiding this comment.
export an old version on 0.4, have a non exported new version
|
It would be breaking to unexport |
|
I think it is flawed to support the syntax of several versions of Julia at the same time and not only the latest version but I guess we are already doing that so I'll remove the part of this PR that touches |
src/Compat.jl
Outdated
| dirs = Array(eltype(content), 0) | ||
| files = Array(eltype(content), 0) | ||
| dirs = Array{eltype(content)}(0) | ||
| files = Array{eltype(content)}(0) |
There was a problem hiding this comment.
This code is copied from Base; I don't think Compat should deviate from it.
There was a problem hiding this comment.
it should be Vector in base then
There was a problem hiding this comment.
The Array{T}(0) pattern is used very frequently in Base. Should that be changed in Base, then it can be changed here too.
There was a problem hiding this comment.
it should, and has been in many places - it's easier on the compiler to call the constructor of a fully parameterized type instead of having to infer the dimensionality
There was a problem hiding this comment.
I couldn't find a Base issue so opened JuliaLang/julia#20114.
test/runtests.jl
Outdated
| @test trunc(Int, [1 1]) == [1 1] | ||
| @test trunc(Int, [1.1 1.1]) == [1 1] | ||
| @test trunc(Int, fill(1.1, 2, 3, 4)) == fill(1, 2, 3, 4) | ||
| if VERSION < v"0.6.0-" |
There was a problem hiding this comment.
be more specific, and anything called on scalars should run everywhere. or better, do @compat and dot syntax everywhere
There was a problem hiding this comment.
Dot syntax doesn't work on 0.4 and 0.5 yet for these functions, see #297.
There was a problem hiding this comment.
okay, then anything on scalars should run everywhere, anything vectorized on the specific julia versions where it's not deprecated
test/runtests.jl
Outdated
| for follow_symlinks in follow_symlink_vec | ||
| task = walkdir(".", follow_symlinks=follow_symlinks) | ||
| root, dirs, files = consume(task) | ||
| task = Compat.walkdir(".", follow_symlinks=follow_symlinks) |
There was a problem hiding this comment.
Should also rename "task", "task_error", etc to "chnl", "chnl_error" everywhere.
|
I've updated the PR such that it doesn't touch |
b83b3b5 to
8053b6f
Compare
|
I've added a fix for #315 as well. It disables the same tests as in https://github.com/JuliaLang/julia/pull/18777/files#diff-3d2d2cb368aae0105589988195f6b11aL341 . |
And multiple outstanding line comments. |
|
@amitmurthy I guess that |
|
task-channel binding is not supported on 0.5 Compat's implementation of walkdir should
I can push a commit to your branch later if you don't mind. |
README.md
Outdated
| * `foreach`, similar to `map` but when the return value is not needed ([#13744]) | ||
|
|
||
| * `walkdir`, returns an iterator that walks the directory tree of a directory ([#13707]) | ||
| * `walkdir`/`Compat.walkdir`, returns an iterator that walks the directory tree of a directory. For compatibility with Julia 0.6- `Compat.walkdir` should be used and `walkdir` should be used for compatibility with the Julia 0.5. ([#13707]) |
There was a problem hiding this comment.
"for compatibility with Julia 0.5"
16ffa63 to
4b5e947
Compare
No longer relevant. The approach to walkdir is different now
| @test trunc(Int, fill(1.1, 2, 3, 4)) == fill(1, 2, 3, 4) | ||
|
|
||
| if VERSION < v"0.6.0-dev.1825" | ||
| @test round(Int, [1, 1]) == [1, 1] |
There was a problem hiding this comment.
I see thanks. I don't care too strongly about these tests on 0.6, so I'm fine with this.
| end | ||
| end | ||
| if VERSION < v"0.6.0-dev.2043" | ||
| Base.take!(t::Task) = consume(t) |
There was a problem hiding this comment.
should be mentioned in readme
There was a problem hiding this comment.
It is notnow mentioned in the README.md.
Make trunc, round, floor, ceil testing more precise
|
Tests failing on nightly now. |
|
Just realized. I think the deprecations caused |
depended on the deprecation definition in Base so it is kind of broken but I have left the definition to minimize the effects of this PR.
|
I think this is good to go. @andreasnoack do the honors? |
* Remove `take!(::Task)` definition for Julia versions prior to 0.6 Was added in #307. * Remove `redirect_std*(f, stream)` definitions for Julia prior to v0.6 Were added in #275. * Remove at-__DIR__ macro definition for Julia versions prior to 0.6 Was added in #281. * Remove `broadcast` definition for equal-length tuples Was added in #324 and #328 * Remove definitions of `unsafe_get` and `isnull` fallsback Were added in #287. * Remove defintions of `xor` and `⊻` Were added in #289. * Definitions of `numerator` and `denominator` Were added in #290. * Remove defintion of `iszero` Was added in #305. * Remove definition of `>:` Was added in #336 * Remove definition of `take!(::Base.AbstractIOBuffer)` Was added in #290. * Remove definiton of `.&` and `.|` Were added in #306. * Remove definition of `Compat.isapprox` Was added in #309.
Since
walkdirreturns aTaskin 0.5 and aChannelin 0.6 the implementation in Compat would need to be updated. For now, I've done this by not exporting theCompatversion such that you'd have to useCompat.walkdirinstead of justwalkdir.promote_eltype_opis now deprecated on master so I've also deprecated theCompatversion.Testing of vectorized
round,ceil,floor, andtruncis disabled on 0.6 since the dot syntax should be used.Some minor syntax deprecations.