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

Functions using axes() fail because Compat exports axes #25

Closed
romainFr opened this issue Dec 27, 2017 · 11 comments
Closed

Functions using axes() fail because Compat exports axes #25

romainFr opened this issue Dec 27, 2017 · 11 comments

Comments

@romainFr
Copy link

Since axes() replaces indices() on master, Compat is now exporting axes(), which broke a few functions in ImageAxis, for example :

using Images
img = AxisArray(reshape(1:192, (8,8,3)), :x, :y, :time)
imedim(img)
WARNING: both AxisArrays and Compat export "axes"; uses of it in module ImageAxes must be qualified
ERROR: UndefVarError: axes not defined
Stacktrace:
 [1] timedim(::AxisArrays.AxisArray{Int64,3,Base.ReshapedArray{Int64,3,UnitRange{Int64},Tuple{}},Tuple{AxisArrays.Axis{:x,Base.OneTo{Int64}},AxisArrays.Axis{:y,Base.OneTo{Int64}},AxisArrays.Axis{:time,Base.OneTo{Int64}}}}) at /localhome/romain/.julia/v0.6/ImageAxes/src/ImageAxes.jl:136

This is on julia 0.6.2.

@Evizero
Copy link
Member

Evizero commented Dec 27, 2017

I noticed this on travis as well. I think this error probably needs to be addressed in multiple packages , but the fix itself should be simple (I think); at least for ImageAxes. Every occurrence of axes just needs to say AxisArrays.axes instead

@Cody-G
Copy link
Contributor

Cody-G commented Dec 29, 2017

I made the fix for this package and also for ImageView. I find it a bit ugly, but I guess this will go away when we drop 0.6 support? Then I think AxisArrays can import axes from base?

@rdeits
Copy link

rdeits commented Dec 29, 2017

If the meaning of axes in AxisArrays is consistent with the new meaning of axes in Base, then AxisArrays could just do import Compat: axes, which should work on 0.6 and 0.7

@rdeits
Copy link

rdeits commented Dec 29, 2017

Ah, but it looks like they do different things for standard Arrays, so importing isn't really an option:

julia> AxisArrays.axes(zeros(5, 6))
(AxisArrays.Axis{:row,Base.OneTo{Int64}}(Base.OneTo(5)), AxisArrays.Axis{:col,Base.OneTo{Int64}}(Base.OneTo(6)))

julia> Compat.axes(zeros(5, 6))
(Base.OneTo(5), Base.OneTo(6))

@Cody-G
Copy link
Contributor

Cody-G commented Dec 29, 2017

Agreed, looks like we'll have to avoid importing unless AxisArrays gets reworked.

@timholy
Copy link
Member

timholy commented Dec 30, 2017

I'd recommend renaming the function in AxisArrays.

I'd tackle this myself, but I'm more than swamped with the last changes to broadcasting infrastructure in 0.7/1.0, so I'm going to hope others tackle this.

@Evizero
Copy link
Member

Evizero commented Dec 30, 2017

I'd recommend renaming the function in AxisArrays.

This sounds like a good longterm solution. In the meantime, are there any objections to merging and tagging the hotfixes in #26 and JuliaImages/ImageView.jl#137 ?

@Evizero
Copy link
Member

Evizero commented Dec 30, 2017

Its worth noting that there seems to be a plan to solve our dilemma upstream JuliaLang/Compat.jl#442

@Cody-G
Copy link
Contributor

Cody-G commented Dec 30, 2017

Its worth noting that there seems to be a plan to solve our dilemma upstream

That's nice! Am I correct that this only rescues 0.6, and for 0.7 we'll still want to use qualified names or rename AxisArrays.axes?

@Evizero
Copy link
Member

Evizero commented Dec 30, 2017

I do not know as I have not spend any time looking into 0.7 as of yet. I do believe though that a lot of updates have to be made all around the JuliaImages ecosystem. So I'd guess this depends on when the planned renaming takes place

@Evizero
Copy link
Member

Evizero commented Jan 1, 2018

Can confirm the original issue is resolved by Compat itself. This should take care of the 0.6 side of the issue at least.

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

No branches or pull requests

5 participants