-
Notifications
You must be signed in to change notification settings - Fork 81
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 support for Julia v1.0 #282
Conversation
Codecov Report
@@ Coverage Diff @@
## master #282 +/- ##
==========================================
+ Coverage 34.69% 34.73% +0.03%
==========================================
Files 17 17
Lines 2908 2908
==========================================
+ Hits 1009 1010 +1
+ Misses 1899 1898 -1
Continue to review full report at Codecov.
|
do you want to try to finish this before we tag? |
The primary hang up is I'm waiting for JuliaGraphics/Cairo.jl#224 to be resolved. I think we should go ahead and tag. 0.7 support can wait. |
It looks like tests are failing partially due to On 0.7 julia> include("src/Compose.jl")
## omitted errors
julia> Compose.isinstalled("Fontconfig")
true On 0.6 julia> include("src/Compose.jl")
Compose
julia> Compose.isinstalled("Fontconfig")
false
|
It looks specifically that Lines 39 to 46 in bda8068
the EDIT: Not sure why this is happening to asked Discourse |
The |
6add91b
to
4e20db6
Compare
On @vtjnash's suggestion I started trying to get |
d7a53e6
to
8858adb
Compare
Thanks to @RalphAS's help and with another round of cleanup, all tests pass on Julia v0.7 (NOTE: This is not backwards compatible due to the iteration protocol changes!). There are a couple silent deprecations that cause the build to crash on v1.0, which I have not yet fixed. Couple things remaining:
|
This PR now successfully passes tests on Julia v1.0 |
8a0c1ba
to
37a9be5
Compare
@@ -369,8 +372,8 @@ end | |||
function push_vector_properties(img::Image, idx::Int) | |||
save_property_state(img) | |||
for (propertytype, property) in img.vector_properties | |||
isnull(property) && continue | |||
primitives = get(property).primitives | |||
(property === nothing) && continue |
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 parens aren't necessary here, though they don't hurt
y = Array{Float64}(1) | ||
ccall((:cairo_get_current_point, Cairo._jl_libcairo), Void, | ||
(Ptr{Void}, Ptr{Float64}, Ptr{Float64}), img.ctx.ptr, x, y) | ||
x = Array{Float64}(undef, 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.
do you know what the thinking is behind julia 1.0 requiring undef
here? is there something else that could be supplied as the first argument?
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 think the thinking is that we should be very clear that we're allocating uninitialized memory, i.e. that x
contains junk values. Here's a thorough discussion: JuliaLang/julia#24595.
.travis.yml
Outdated
- | | ||
julia -e ' | ||
using Compose, Pkg | ||
pkg"add Colors Documenter" |
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.
should Cairo be removed from docs/REQUIRE?
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 forgot about docs/REQUIRE
so I could just load everything that is there or just delete it. Thoughts?
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.
loading everything that is there would be one less thing to remember to change if docs/REQUIRE were to change in future. the code to do that is already in master.
src/Compose.jl
Outdated
@@ -204,6 +180,7 @@ try | |||
getfield(Compose, :Cairo) # throws if Cairo isn't being used | |||
show(io::IO, ::MIME"image/png", ctx::Context) = | |||
draw(PNG(io, default_graphic_width, default_graphic_height), ctx) |
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.
could these three lines be added to cairo_backends.jl? seems better to conditionally include them via Requires.jl instead of a try/catch.
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.
Good catch. I'll move it.
:CairoPDFSurface, :CairoSVGSurface, :CairoImageSurface) | ||
val = getfield(Cairo,name) | ||
@eval const $name = $val | ||
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.
what's the reason for the change here? does using Cairo: ...
not work with Requires?
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.
This is from @RalphAS's original approach that worked on both v0.6 and v0.7, but I think we can revert it to the simpler case since we're dropping support for v0.6 going forward.
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 don't understand why using Cairo: ...
doesn't work on both 0.6 and 0.7...
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.
What was previously written should work exactly as intended as far back as 0.3, if not earlier.
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.
Changing this back leads to warnings (maybe @RalphAS can help us understand why?)
julia> using Compose
[ Info: Loading Cairo backend into Compose.jl
┌ Warning: Package Compose does not have Cairo in its dependencies:
│ - If you have Compose checked out for development and have
│ added Cairo as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Compose
└ Loading Cairo into Compose from project dependency, future warnings for Compose are suppressed.
#global PDF | ||
PNG(::Any, args...) = error(@missing_cairo_error "PNG") | ||
PS(::Any, args...) = error(@missing_cairo_error "PS") | ||
PDF(::Any, args...) = error(@missing_cairo_error "PDF") |
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.
could these three lines be simplified to PNG = error...
? none of the input args are actually used.
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 think I had tried that originally and I was getting illegal constant redefinitions.
include("svg.jl") | ||
include("pgf_backend.jl") | ||
|
||
# If available, pango and fontconfig are used to compute text extents and match | ||
# fonts. Otherwise a simplistic pure-julia fallback is used. | ||
|
||
if isinstalled("Fontconfig") | ||
include("fontfallback.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.
to the extent that fontfallback.jl mimics pango well, we should really hype up the fact that Gadfly can generate SVG with pure julia. maybe add a comment in the Compose README or docs.
looks great! thanks for working on this. we should probably wait to tag a final julia 0.6 release of compose until we can do so simultaneously for gadfly. once this merges i'll run the scripts to see what other gadfly dependencies are still not working on julia 0.7. |
REQUIRE
Outdated
@@ -1,7 +1,7 @@ | |||
julia 0.6 |
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.
should change this to 0.7 if it's not backwards compatible due to the new iteration protocol
make sure to close #226 when this is merged |
Have you tried asking over on discourse? That's basically impossible to track down with so little info.
Agreed. While the regressions are worrisome, they aren't showstoppers. We need to at least have a beta at this point. I'm in favor of merging into master and then letting people take it for a spin. |
the broadcast / Ref() warning is now fixed, and i believe all the regression errors are due to the change in Random. so... let's do this! |
Note that there is a more general solution than wrapping things in Ref(). e.g. in Julia 0.7, the following results in the same error above: using Measures
a = [1mm,2mm,4mm]
a .+ 1mm but this will work after implementing: Broadcast.broadcastable(x::T) where T<:Measure = Ref(x) which makes things easier for general use. |
this is a follow up to #279 temp hack for missing load_cache_path on 0.7 See JuliaLang/Compat.jl#527 for details replace more voids that slipped past the first round more deprecation fixes prelim work on adding optional runtime backend loading use Compat's @info so we don't break v0.6
This version works if callers of PNG etc. import Cairo themselves.
update ci and doc gen; drop support for julia v0.6 allow failures on nightly
drop Compat.jl and vestigial compat layers fixes for doc building and coverage using is required to load pkg_str macro fix for silly parenthesis error drop 0.6 support and simplify travis config
a9cfdad
to
909f22f
Compare
I just squashed and rebased. This ready to merge.
|
@simonschoelly identified this problem in #282 (comment) where calling show would lead to a stackoverflow error due to infinite recursion. The solution is to explicitly invoke Base's abstract show function when the non-compact form is requested to prevent the runaway recursion.
b731974 fixes the problem identified by @simonschoelly so now printing works as expected in the noncompact/default case too. |
@Mattriks care to submit a PR to Measures.jl with your solution? much better than mine! |
AFAIK, this PR is ready to be merged. I've tried to address all points raised in the review. |
Looks like there are no major objections so I'm going to go ahead and pull the trigger. We should let 1.0 support stew on master for a week give or take and then tag a new release. This'll give people time to put it through its paces and make sure that everything is working well. |
This solution was identified by @Mattriks over in GiovineItalia/Compose.jl#282 (comment)
This solution was identified by @Mattriks over in GiovineItalia/Compose.jl#282 (comment)
This finishes the
Nullable{T}
==>Union{T, Nothing}
transition started in #279. I decided that it wasn't worth using theNullables.jl
because it's a dead-end archive package and we might as well transition to the new representation of uninitialized values.8dd674d is a temporary hack because
LOAD_CACHE_PATH
was deleted in v0.7. I only did this to get tests to pass locally on both v0.6 and v0.7 and I want to make sure CI passes. I'll revert this commit once an actual solution is found (see JuliaLang/Compat.jl#527) before merging