From 11bf245eee9b3138f7145988d17896f8a16a7376 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:28:09 +0100 Subject: [PATCH 01/12] fix `PythonPlot` backend --- .gitignore | 1 + Project.toml | 5 +++-- src/backends.jl | 14 ++++++++++---- src/backends/pythonplot.jl | 10 +++++----- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 48ae0045c..39b6f9a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ test/tmpplotsave.hdf5 /.benchmarkci /benchmark/*.json .vscode/ +.CondaPkg/ \ No newline at end of file diff --git a/Project.toml b/Project.toml index d12184448..8fff71d91 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Plots" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" author = ["Tom Breloff (@tbreloff)"] -version = "1.40.2" +version = "1.40.3" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -23,6 +23,7 @@ PlotThemes = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a" PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" @@ -79,7 +80,7 @@ PlotlyJS = "0.18" PlotlyKaleido = "1" PrecompileTools = "1" PyPlot = "2" -PythonPlot = "1 - 1.0.2" +PythonPlot = "1" RecipesBase = "1.3.1" RecipesPipeline = "0.6.10" Reexport = "0.2, 1" diff --git a/src/backends.jl b/src/backends.jl index faa104efe..1a75a940a 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -1048,13 +1048,19 @@ const _pyplot_scale = [:identity, :ln, :log2, :log10] _post_imports(::PythonPlotBackend) = @eval begin const PythonPlot = Main.PythonPlot const PythonCall = Main.PythonPlot.PythonCall - mpl_toolkits = PythonCall.pyimport("mpl_toolkits") - mpl = PythonCall.pyimport("matplotlib") - numpy = PythonCall.pyimport("numpy") + const mpl_toolkits = PythonPlot.pyimport("mpl_toolkits") + const mpl = PythonPlot.pyimport("matplotlib") + const numpy = PythonPlot.pyimport("numpy") - PythonCall.pyimport("mpl_toolkits.axes_grid1") + PythonPlot.pyimport("mpl_toolkits.axes_grid1") numpy.seterr(invalid = "ignore") + const pyisnone = if isdefined(PythonCall, :pyisnone) + PythonCall.pyisnone + else + PythonCall.Core.pyisnone + end + PythonPlot.ioff() # we don't want every command to update the figure end _runtime_init(::PythonPlotBackend) = nothing diff --git a/src/backends/pythonplot.jl b/src/backends/pythonplot.jl index 421c11fc9..38ef52574 100644 --- a/src/backends/pythonplot.jl +++ b/src/backends/pythonplot.jl @@ -208,15 +208,15 @@ _py_renderer(fig) = _py_canvas(fig).get_renderer() _py_drawfig(fig) = fig.draw(_py_renderer(fig)) # `get_points` returns a numpy array in the form [x0 y0; x1 y1] coords (origin is bottom-left (0, 0)!) -_py_extents(obj) = PythonCall.PyArray(obj.get_window_extent().get_points()) +_py_extents(obj) = PythonPlot.PyArray(obj.get_window_extent().get_points()) # see cjdoris.github.io/PythonCall.jl/stable/conversion-to-julia/#py2jl-conversion -to_vec(x) = PythonCall.pyconvert(Vector, x) -to_str(x) = PythonCall.pyconvert(String, x) +to_vec(x) = PythonPlot.pyconvert(Vector, x) +to_str(x) = PythonPlot.pyconvert(String, x) # compute a bounding box (with origin top-left), however PythonPlot gives coords with origin bottom-left function _py_bbox(obj) - PythonCall.pyisnone(obj) && return _py_bbox(nothing) + pyisnone(obj) && return _py_bbox(nothing) fl, fr, fb, ft = bb = _py_extents(obj.get_figure()) l, r, b, t = ex = _py_extents(obj) # @show obj bb ex @@ -912,7 +912,7 @@ function _before_layout_calcs(plt::Plot{PythonPlotBackend}) (cmap = func(cbar_series)) === nothing || break end c_map = mpl.cm.ScalarMappable(; cmap, norm) - c_map.set_array(PythonCall.pylist([])) + c_map.set_array(PythonPlot.pylist([])) c_map else cbar_series[:serieshandle][end] From d224ea4480134cb0e019bee5c62e3b809722256b Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:34:35 +0100 Subject: [PATCH 02/12] update CI --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f207c927b..c2fe36077 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,13 @@ jobs: continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false + continue-on-error: ${{ matrix.experimental }} matrix: version: - '1.6' # LTS (minimal declared julia compat in `Project.toml`) - - '1.9' # latest stable + - '1' # latest stable + experimental: + - false os: [ubuntu-latest, windows-latest, macos-latest] arch: [x64] include: @@ -43,11 +46,15 @@ jobs: version: '1.8' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest prefix: xvfb-run - version: '~1.10.0-0' # upcoming julia version, next `rc` + version: '1.9' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest + experimental: true + prefix: xvfb-run + version: '~1.11.0-0' # upcoming julia version, next `rc` + - os: ubuntu-latest + experimental: true prefix: xvfb-run version: 'nightly' - allow_failure: true # `nightly` often breaks steps: - uses: actions/checkout@v4 From cc7dd1c7a511cf1f7905897980d1c0d1568bcfcb Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:37:50 +0100 Subject: [PATCH 03/12] fix action --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2fe36077..36235d6da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,11 +22,10 @@ jobs: JULIA_CONDAPKG_BACKEND: "MicroMamba" MPLBACKEND: "agg" name: Julia ${{ matrix.version }} - ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false - continue-on-error: ${{ matrix.experimental }} matrix: version: - '1.6' # LTS (minimal declared julia compat in `Project.toml`) From ee769bb1591818a22d2f0c031e05fd75ba59297f Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:38:27 +0100 Subject: [PATCH 04/12] update --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36235d6da..05b46c0f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,9 @@ jobs: v"3.4.29" => ">=11.1,<12.1", v"3.4.30" => ">=12.1,<13.1", v"3.4.31" => ">=13.1,<14.1", - # ... keep this up-to-date with gcc 14 + v"3.4.32" => ">=14.1,<15.1", # gcc-14 + v"3.4.33" => ">=15.1,<16.1", # gcc-15 + # ... keep this up-to-date with gcc 16 )[Base.BinaryPlatforms.detect_libstdcxx_version()] ("libgcc-ng$specs", "libstdcxx-ng$specs") else From 788998b759fa391510c4c35af1b57deefb2fe363 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:40:10 +0100 Subject: [PATCH 05/12] fix experimental --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05b46c0f9..0b15b025a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,9 @@ name: ci on: + pull_request: push: branches: [master] - pull_request: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -36,14 +36,17 @@ jobs: arch: [x64] include: - os: ubuntu-latest + experimental: false prefix: xvfb-run # julia-actions/julia-runtest/blob/master/README.md - os: ubuntu-latest prefix: xvfb-run version: '1.7' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest + experimental: false prefix: xvfb-run version: '1.8' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest + experimental: false prefix: xvfb-run version: '1.9' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest From 6c8657de91eeb02069e243ac9d534ddab7ca2a98 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:41:48 +0100 Subject: [PATCH 06/12] fix --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b15b025a..835ad380b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: experimental: false prefix: xvfb-run # julia-actions/julia-runtest/blob/master/README.md - os: ubuntu-latest + experimental: false prefix: xvfb-run version: '1.7' # only test intermediate release on `ubuntu` to spare resources - os: ubuntu-latest From f79627aabc03566eb739987a6dc687b9f6025a50 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 13:54:35 +0100 Subject: [PATCH 07/12] fix stale deps --- Project.toml | 31 +++++++++++++++---------------- test/test_quality.jl | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Project.toml b/Project.toml index 8fff71d91..75c127fa5 100644 --- a/Project.toml +++ b/Project.toml @@ -23,7 +23,6 @@ PlotThemes = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a" PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" @@ -41,20 +40,6 @@ UnicodeFun = "1cfade01-22cf-5700-b092-accc4b62d6e1" UnitfulLatexify = "45397f5d-5981-4c77-b2b3-fc36d6e9b728" Unzip = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d" -[weakdeps] -FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" -IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" -ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254" -Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" - -[extensions] -FileIOExt = "FileIO" -GeometryBasicsExt = "GeometryBasics" -IJuliaExt = "IJulia" -ImageInTerminalExt = "ImageInTerminal" -UnitfulExt = "Unitful" - [compat] Aqua = "0.8" Contour = "0.5 - 0.6" @@ -94,7 +79,14 @@ UnicodeFun = "0.4" UnicodePlots = "3.4" UnitfulLatexify = "1" Unzip = "0.1 - 0.2" -julia = "1.10" +julia = "1.6" + +[extensions] +FileIOExt = "FileIO" +GeometryBasicsExt = "GeometryBasics" +IJuliaExt = "IJulia" +ImageInTerminalExt = "ImageInTerminal" +UnitfulExt = "Unitful" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" @@ -132,3 +124,10 @@ VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" [targets] test = ["Aqua", "Colors", "Distributions", "FileIO", "FilePathsBase", "FreeType", "Gaston", "GeometryBasics", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "PlotlyBase", "PyPlot", "PythonPlot", "PlotlyKaleido", "HDF5", "RDatasets", "SentinelArrays", "StableRNGs", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "Unitful", "VisualRegressionTests"] + +[weakdeps] +FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" +GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" +IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" +ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" diff --git a/test/test_quality.jl b/test/test_quality.jl index bc5599ed6..d38c2b331 100644 --- a/test/test_quality.jl +++ b/test/test_quality.jl @@ -1,7 +1,7 @@ @testset "Auto QUality Assurance" begin # JuliaTesting/Aqua.jl/issues/77 # TODO: fix :Contour, :Latexify and :LaTeXStrings stale imports in Plots 2.0 - # :PyCall and :Conda stale deps show up when running CI + # :Conda stale deps show up when running CI Aqua.test_all( Plots; stale_deps = (; From 99eab8ddab843578d0dcfefa422150c2f1039a64 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 14:11:57 +0100 Subject: [PATCH 08/12] update versions --- .github/workflows/ci.yml | 4 ++-- Project.toml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 835ad380b..2e7445d06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,8 +100,8 @@ jobs: v"3.4.29" => ">=11.1,<12.1", v"3.4.30" => ">=12.1,<13.1", v"3.4.31" => ">=13.1,<14.1", - v"3.4.32" => ">=14.1,<15.1", # gcc-14 - v"3.4.33" => ">=15.1,<16.1", # gcc-15 + v"3.4.32" => ">=14.1,<15.1", + v"3.4.33" => ">=15.1,<16.1", # ... keep this up-to-date with gcc 16 )[Base.BinaryPlatforms.detect_libstdcxx_version()] ("libgcc-ng$specs", "libstdcxx-ng$specs") diff --git a/Project.toml b/Project.toml index 75c127fa5..5cdbc2f8f 100644 --- a/Project.toml +++ b/Project.toml @@ -48,12 +48,12 @@ FFMPEG = "0.3, 0.4" FixedPointNumbers = "0.6 - 0.8" GR = "0.69.5 - 0.73" Gaston = "1" -HDF5 = "0.16" +HDF5 = "0.16 - 0.17" InspectDR = "0.5" JLFzf = "0.1" JSON = "0.21, 1" LaTeXStrings = "1" -Latexify = "0.14 - 0.15, 0.16" +Latexify = "0.14 - 0.16" Measures = "0.3" NaNMath = "0.3, 1" PGFPlots = "3" @@ -74,7 +74,7 @@ Requires = "1" Scratch = "1" Showoff = "0.3.1, 1" Statistics = "1" -StatsBase = "0.33, 0.34" +StatsBase = "0.33 - 0.34" UnicodeFun = "0.4" UnicodePlots = "3.4" UnitfulLatexify = "1" From 90273af2e4617bff8004d942824843a6249ed277 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 14:52:10 +0100 Subject: [PATCH 09/12] update tests --- test/runtests.jl | 1 - test/test_output.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index cb98dbfa1..72b7b4e77 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -29,7 +29,6 @@ const TEST_BACKENDS = :gr, :unicodeplots, :pythonplot, :pgfplotsx, :plotlyjs, :g unicodeplots() pgfplotsx() plotlyjs() -plotly() hdf5() gr() diff --git a/test/test_output.jl b/test/test_output.jl index 5fb80018f..412dd9723 100644 --- a/test/test_output.jl +++ b/test/test_output.jl @@ -55,7 +55,7 @@ Plots.with(:plotlyjs) do # @test_save :eps end -Plots.with(:plotly) do +Sys.isunix() && Plots.with(:plotly) do @test_save :pdf @test_save :png @test_save :svg From fadf423fd1fd670ff2f861393fc3230ba1707f1f Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 15:17:43 +0100 Subject: [PATCH 10/12] restrict plotly test to unix --- test/test_plotly.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_plotly.jl b/test/test_plotly.jl index 8b172d2a6..b50c2323d 100644 --- a/test/test_plotly.jl +++ b/test/test_plotly.jl @@ -1,5 +1,5 @@ using Plots, Test -Plots.with(:plotly) do +Sys.isunix() && Plots.with(:plotly) do @testset "Basic" begin @test backend() == Plots.PlotlyBackend() From 7f9a17d819b34ceebbe2827651fe41877ac158ea Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 15:47:01 +0100 Subject: [PATCH 11/12] restrict plotlyjs output to unix --- test/test_output.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_output.jl b/test/test_output.jl index 412dd9723..b1c4cc4bc 100644 --- a/test/test_output.jl +++ b/test/test_output.jl @@ -46,7 +46,7 @@ Plots.with(:unicodeplots) do end end -Plots.with(:plotlyjs) do +Sys.isunix() && Plots.with(:plotlyjs) do @test_save :html @test_save :json @test_save :pdf From 0236bacc0fb5325cbf11956ff000e53c84e0db64 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sat, 30 Mar 2024 15:47:38 +0100 Subject: [PATCH 12/12] update --- test/test_output.jl | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/test/test_output.jl b/test/test_output.jl index b1c4cc4bc..86bfc75df 100644 --- a/test/test_output.jl +++ b/test/test_output.jl @@ -46,20 +46,22 @@ Plots.with(:unicodeplots) do end end -Sys.isunix() && Plots.with(:plotlyjs) do - @test_save :html - @test_save :json - @test_save :pdf - @test_save :png - @test_save :svg - # @test_save :eps -end +if Sys.isunix() + Plots.with(:plotlyjs) do + @test_save :html + @test_save :json + @test_save :pdf + @test_save :png + @test_save :svg + # @test_save :eps + end -Sys.isunix() && Plots.with(:plotly) do - @test_save :pdf - @test_save :png - @test_save :svg - @test_save :html + Plots.with(:plotly) do + @test_save :pdf + @test_save :png + @test_save :svg + @test_save :html + end end if Sys.islinux() && Sys.which("pdflatex") ≢ nothing