-
Notifications
You must be signed in to change notification settings - Fork 14
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
Updates for Julia 1.0 #101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
=========================================
- Coverage 97.53% 97.24% -0.3%
=========================================
Files 11 11
Lines 284 290 +6
=========================================
+ Hits 277 282 +5
- Misses 7 8 +1
Continue to review full report at Codecov.
|
Wow, the userimage tests segfault on 0.7 and 1.0. 😬 |
Since we're using TestSetExtensions in the tests here, we might need ssfrr/TestSetExtensions.jl#7 before this will work properly. 😕 |
9b9018a
to
a3026dc
Compare
VERSION >= v"0.7.0-DEV.5183" || cd(Pkg.dir("Memento")) | ||
Pkg.add("Documenter") | ||
include(joinpath("docs", "make.jl")) | ||
' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sometimes combine these lines so I don't require the double VERSION checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer having coverage submission and documentation deployment as separate steps, even if it means duplicating some logic until we drop 0.6.
.travis/test.sh
Outdated
julia --color=yes -e ' | ||
if VERSION >= v"0.7.0-DEV.3382" | ||
using Libdl | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make this a one-liner
src/records.jl
Outdated
if isdefined(Base, :iterate) | ||
function Base.iterate(rec::T, state=0) where T <: Record | ||
state >= fieldcount(T) && return nothing | ||
new_state = state + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reuse state
?
state += 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just reusing what was there in the Base.next
definition. I agree that's nicer.
src/records.jl
Outdated
state >= fieldcount(T) && return nothing | ||
new_state = state + 1 | ||
return (fieldname(T, new_state) => get(getfield(rec, new_state)), new_state) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two iterate methods have the same body. Combine with T <: Union{Record, AttributeRecord}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close but not quite: Note that AttributeRecord
needs to call get
on the result of getfield
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gross
test/handlers.jl
Outdated
@@ -106,7 +106,7 @@ | |||
|
|||
@testset "Sample Usage w/ File" begin | |||
filename = tempname() | |||
info("Path to log file: $filename") | |||
Compat.@info("Path to log file: $filename") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal preference but I prefer doing using Compat: @info
so I don't have to have Compat.*
peppered throughout the code. Will make dropping 0.6 support later easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The userimg tests segfaulting might actually indicate issues with the library. The root cause should be identified and documented.
@rofinn liked the indication of progress that TestSetExtensions gives. He may prefer removing the global testset to return the old behaviour.
test/io.jl
Outdated
@@ -9,7 +9,7 @@ | |||
"fubar" => 50 | |||
) | |||
roller_prefix = tempname() | |||
info("Path to roller_prefix: $roller_prefix") | |||
Compat.@info("Path to roller_prefix: $roller_prefix") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't have to be Compat.
anymore since you imported it in test/runtests.jl right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoops, I missed that one.
test/runtests.jl
Outdated
Base.next(cr::ConstRecord, state) = next(_props(cr), state) | ||
Base.done(cr::ConstRecord, state) = done(_props(cr), state) | ||
if isdefined(Base, :iterate) | ||
Base.iterate(cr::ConstRecord, state=1) = iterate(_props(cr), state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do state...
and pass it right through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and pass it right through
How do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base.iterate(cr::ConstRecord, state...) = iterate(_props(cr), state...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Is that preferable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't assume iteration state, so yeah. Performance doesn't matter for this but I think there are splatting optimizations for small tuples.
It's unrelated to Memento:
Apparently as of JuliaLang/julia#24410, the |
We'll need to change it to use |
|
So the documented function doesn't work? https://docs.julialang.org/en/latest/devdocs/sysimg/#Building-the-Julia-system-image-1 That's...worrying |
I didn't realize we had it documented. I think once JuliaLang/julia#21849 landed, rebuilding the sysimage became pretty uncommon, so no one paid much attention to the machinery in place that worked around the initial limitation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that I was considering using @includetests
from TestSetExtensions for running a subset of the tests (e.g., benchmarks). The @includetests
macro displays each file file being tested.
.travis/test.sh
Outdated
@@ -2,20 +2,61 @@ | |||
|
|||
set -ev | |||
|
|||
# Set up the build environment across Julia versions | |||
# This portion is the same as the default Travis test script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include a link to the default Travis test script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.travis/test.sh
Outdated
if [[ -a .git/shallow ]]; then | ||
git fetch --unshallow | ||
fi | ||
if [[ -f Project.toml || -f JuliaProject.toml ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this condition entirely necessary while we don't have a Project.toml? Unrelated, but is there a reason there are two *Project.toml files now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JuliaProject.toml is for when you have some other system that requires Project.toml. If it exists it'll be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the condition isn't necessary but it seemed simpler to me to duplicate the Travis logic wholesale and not have to remember to update things here when we do add a Project.toml file.
Now `info` and `warn` are only imported and extended from Base when they're defined in Base. Further, Travis and AppVeyor have been updated to handle versions 0.6 through 1.0.
It currently does not (and likely cannot) work on Julia versions 0.7 and 1.0.
The --output-o option is hidden as of 0.7 and no longer appears to work properly: what works in 0.6 segfaults in 0.7.
Apparently `Base.reinit_stdio()` is required to avoid libuv segfaulting
Well, I fixed the segfault but the userimage tests still don't work. ¯\_(ツ)_/¯ |
Seems like the script that runs it just needs to tell Pkg3 where to find Memento? |
Maybe, but I'm not sure; in testing I've been using the stdlib Test rather than Memento, which should be easier for Julia to find, but it still errors saying it can't find it. Kristoffer was helping me diagnose the other day but we didn't come to a conclusion. |
Now
info
andwarn
are only imported and extended from Base when they're defined in Base. Travis and AppVeyor have been updated to handle versions 0.6 through 1.0.Supersedes #100.