JuliaData / CategoricalArrays.jl

Arrays for working with categorical data (both nominal and ordinal)
Other
125 stars 33 forks source link

Consider adding RecipesBase as a direct dependency #388

Closed BeastyBlacksmith closed 1 year ago

BeastyBlacksmith commented 2 years ago

I think RecipesBase is small enough that it shouldn't impact loading time of CategoricalArrays too much, while currently I get world age issues with an example using CategoricalArrays in the Plots.jl test-suite.

  The applicable method may be too new: running in world age 32613, while current world is 32885.
  Closest candidates are:
    (::CategoricalArrays.var"#128#130")(::Any) at ~/.julia/packages/CategoricalArrays/F7Q0Y/src/CategoricalArrays.jl:49 (method too new to be called from this world context.)
Stacktrace:
    [1] iterate
      @ ./generator.jl:47 [inlined]
    [2] _collect
      @ ./array.jl:744 [inlined]
    [3] collect_similar(cont::Vector{Float64}, itr::Base.Generator{Vector{Float64}, CategoricalArrays.var"#128#130"{Vector{Union{Missing, String}}}})
      @ Base ./array.jl:653
    [4] map(f::Function, A::Vector{Float64})
      @ Base ./abstractarray.jl:2849
    [5] optimal_ticks_and_labels(ticks::Base.OneTo{Int64}, alims::Tuple{Float64, Float64}, scale::Symbol, formatter::Function)
      @ Plots ~/.julia/dev/Plots/src/axes.jl:205
    [6] get_ticks(::Base.OneTo{Int64}, ::Vector{Float64}, ::Vector{Any}, ::Tuple{Float64, Float64}, ::Vararg{Any})
      @ Plots ~/.julia/dev/Plots/src/axes.jl:323
    [7] get_ticks(sp::Plots.Subplot{Plots.GRBackend}, axis::Plots.Axis; update::Bool)
      @ Plots ~/.julia/dev/Plots/src/axes.jl:241
    [8] get_ticks
      @ ~/.julia/dev/Plots/src/axes.jl:224 [inlined]
    [9] _update_min_padding!(sp::Plots.Subplot{Plots.GRBackend})
      @ Plots ~/.julia/dev/Plots/src/backends/gr.jl:888
   [10] iterate
      @ ./generator.jl:47 [inlined]
   [11] _collect(c::Matrix{AbstractLayout}, itr::Base.Generator{Matrix{AbstractLayout}, typeof(Plots._update_min_padding!)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{2})
      @ Base ./array.jl:744
   [12] collect_similar
      @ ./array.jl:653 [inlined]
   [13] map
      @ ./abstractarray.jl:2849 [inlined]
   [14] _update_min_padding!(layout::Plots.GridLayout)
      @ Plots ~/.julia/dev/Plots/src/layouts.jl:290
   [15] prepare_output(plt::Plots.Plot{Plots.GRBackend})
      @ Plots ~/.julia/dev/Plots/src/plot.jl:224
   [16] show
      @ ~/.julia/dev/Plots/src/output.jl:204 [inlined]
   [17] #265
      @ ~/.julia/dev/Plots/src/output.jl:6 [inlined]
   [18] open(::Plots.var"#265#266"{Plots.Plot{Plots.GRBackend}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ Base ./io.jl:330
   [19] open
      @ ./io.jl:328 [inlined]
   [20] png(plt::Plots.Plot{Plots.GRBackend}, fn::String)
      @ Plots ~/.julia/dev/Plots/src/output.jl:5
   [21] png(fn::String)
      @ Plots ~/.julia/dev/Plots/src/output.jl:9
   [22] (::var"#159#160"{Plots.PlotExample})(fn::String, idx::Int64)
      @ Main ~/.julia/dev/Plots/test/imgcomp.jl:48
   [23] test_images(visualtest::VisualTest; popup::Bool, kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:sigma, :tol, :newfn), Tuple{Vector{Int64}, Float64, String}}})
      @ VisualRegressionTests ~/.julia/packages/VisualRegressionTests/iwuPr/src/imgcomp.jl:48
   [24] image_comparison_tests(pkg::Symbol, idx::Int64; debug::Bool, popup::Bool, sigma::Vector{Int64}, tol::Float64)
      @ Main ~/.julia/dev/Plots/test/imgcomp.jl:53
   [25] macro expansion
      @ ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
   [26] image_comparison_facts(pkg::Symbol; skip::Vector{Any}, only::Nothing, debug::Bool, sigma::Vector{Int64}, tol::Float64)
      @ Main ~/.julia/dev/Plots/test/imgcomp.jl:67

Maybe it's about the closure returned by the recipe.

nalimilan commented 2 years ago

The problem is that there are many small packages that could be added a dependencies (have a look at the @require calls in __init__), and yet people already complain that CategoricalArrays is heavy.

Are you sure that error is related to the use of Requires.jl? If so it would be interesting to report this error there.

nalimilan commented 1 year ago

We have moved to extensions in Julia 1.9 (https://github.com/JuliaData/CategoricalArrays.jl/pull/400) so hopefully this shouldn't happen anymore. If it does, it should definitely be reported against Julia.