Skip to content

Commit 2eef1d7

Browse files
authored
fix PythonPlot backend - bump version (#4911)
1 parent 610b0fc commit 2eef1d7

File tree

9 files changed

+71
-51
lines changed

9 files changed

+71
-51
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: ci
22

33
on:
4+
pull_request:
45
push:
56
branches: [master]
6-
pull_request:
77

88
concurrency:
99
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -22,32 +22,42 @@ jobs:
2222
JULIA_CONDAPKG_BACKEND: "MicroMamba"
2323
MPLBACKEND: "agg"
2424
name: Julia ${{ matrix.version }} - ${{ matrix.os }}
25+
continue-on-error: ${{ matrix.experimental }}
2526
runs-on: ${{ matrix.os }}
26-
continue-on-error: ${{ matrix.version == 'nightly' }}
2727
strategy:
2828
fail-fast: false
2929
matrix:
3030
version:
3131
- '1.6' # LTS (minimal declared julia compat in `Project.toml`)
32-
- '1.9' # latest stable
32+
- '1' # latest stable
33+
experimental:
34+
- false
3335
os: [ubuntu-latest, windows-latest, macos-latest]
3436
arch: [x64]
3537
include:
3638
- os: ubuntu-latest
39+
experimental: false
3740
prefix: xvfb-run # julia-actions/julia-runtest/blob/master/README.md
3841
- os: ubuntu-latest
42+
experimental: false
3943
prefix: xvfb-run
4044
version: '1.7' # only test intermediate release on `ubuntu` to spare resources
4145
- os: ubuntu-latest
46+
experimental: false
4247
prefix: xvfb-run
4348
version: '1.8' # only test intermediate release on `ubuntu` to spare resources
4449
- os: ubuntu-latest
50+
experimental: false
51+
prefix: xvfb-run
52+
version: '1.9' # only test intermediate release on `ubuntu` to spare resources
53+
- os: ubuntu-latest
54+
experimental: true
4555
prefix: xvfb-run
46-
version: '~1.10.0-0' # upcoming julia version, next `rc`
56+
version: '~1.11.0-0' # upcoming julia version, next `rc`
4757
- os: ubuntu-latest
58+
experimental: true
4859
prefix: xvfb-run
4960
version: 'nightly'
50-
allow_failure: true # `nightly` often breaks
5161

5262
steps:
5363
- uses: actions/checkout@v4
@@ -90,7 +100,9 @@ jobs:
90100
v"3.4.29" => ">=11.1,<12.1",
91101
v"3.4.30" => ">=12.1,<13.1",
92102
v"3.4.31" => ">=13.1,<14.1",
93-
# ... keep this up-to-date with gcc 14
103+
v"3.4.32" => ">=14.1,<15.1",
104+
v"3.4.33" => ">=15.1,<16.1",
105+
# ... keep this up-to-date with gcc 16
94106
)[Base.BinaryPlatforms.detect_libstdcxx_version()]
95107
("libgcc-ng$specs", "libstdcxx-ng$specs")
96108
else

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ test/tmpplotsave.hdf5
1313
/.benchmarkci
1414
/benchmark/*.json
1515
.vscode/
16+
.CondaPkg/

Project.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Plots"
22
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
33
author = ["Tom Breloff (@tbreloff)"]
4-
version = "1.40.2"
4+
version = "1.40.3"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -40,20 +40,6 @@ UnicodeFun = "1cfade01-22cf-5700-b092-accc4b62d6e1"
4040
UnitfulLatexify = "45397f5d-5981-4c77-b2b3-fc36d6e9b728"
4141
Unzip = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
4242

43-
[weakdeps]
44-
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
45-
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
46-
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
47-
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
48-
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
49-
50-
[extensions]
51-
FileIOExt = "FileIO"
52-
GeometryBasicsExt = "GeometryBasics"
53-
IJuliaExt = "IJulia"
54-
ImageInTerminalExt = "ImageInTerminal"
55-
UnitfulExt = "Unitful"
56-
5743
[compat]
5844
Aqua = "0.8"
5945
Contour = "0.5 - 0.6"
@@ -62,12 +48,12 @@ FFMPEG = "0.3, 0.4"
6248
FixedPointNumbers = "0.6 - 0.8"
6349
GR = "0.69.5 - 0.73"
6450
Gaston = "1"
65-
HDF5 = "0.16"
51+
HDF5 = "0.16 - 0.17"
6652
InspectDR = "0.5"
6753
JLFzf = "0.1"
6854
JSON = "0.21, 1"
6955
LaTeXStrings = "1"
70-
Latexify = "0.14 - 0.15, 0.16"
56+
Latexify = "0.14 - 0.16"
7157
Measures = "0.3"
7258
NaNMath = "0.3, 1"
7359
PGFPlots = "3"
@@ -79,7 +65,7 @@ PlotlyJS = "0.18"
7965
PlotlyKaleido = "1"
8066
PrecompileTools = "1"
8167
PyPlot = "2"
82-
PythonPlot = "1 - 1.0.2"
68+
PythonPlot = "1"
8369
RecipesBase = "1.3.1"
8470
RecipesPipeline = "0.6.10"
8571
Reexport = "0.2, 1"
@@ -88,12 +74,19 @@ Requires = "1"
8874
Scratch = "1"
8975
Showoff = "0.3.1, 1"
9076
Statistics = "1"
91-
StatsBase = "0.33, 0.34"
77+
StatsBase = "0.33 - 0.34"
9278
UnicodeFun = "0.4"
9379
UnicodePlots = "3.4"
9480
UnitfulLatexify = "1"
9581
Unzip = "0.1 - 0.2"
96-
julia = "1.10"
82+
julia = "1.6"
83+
84+
[extensions]
85+
FileIOExt = "FileIO"
86+
GeometryBasicsExt = "GeometryBasics"
87+
IJuliaExt = "IJulia"
88+
ImageInTerminalExt = "ImageInTerminal"
89+
UnitfulExt = "Unitful"
9790

9891
[extras]
9992
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
@@ -131,3 +124,10 @@ VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
131124

132125
[targets]
133126
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"]
127+
128+
[weakdeps]
129+
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
130+
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
131+
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
132+
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
133+
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

src/backends.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,13 +1048,19 @@ const _pyplot_scale = [:identity, :ln, :log2, :log10]
10481048
_post_imports(::PythonPlotBackend) = @eval begin
10491049
const PythonPlot = Main.PythonPlot
10501050
const PythonCall = Main.PythonPlot.PythonCall
1051-
mpl_toolkits = PythonCall.pyimport("mpl_toolkits")
1052-
mpl = PythonCall.pyimport("matplotlib")
1053-
numpy = PythonCall.pyimport("numpy")
1051+
const mpl_toolkits = PythonPlot.pyimport("mpl_toolkits")
1052+
const mpl = PythonPlot.pyimport("matplotlib")
1053+
const numpy = PythonPlot.pyimport("numpy")
10541054

1055-
PythonCall.pyimport("mpl_toolkits.axes_grid1")
1055+
PythonPlot.pyimport("mpl_toolkits.axes_grid1")
10561056
numpy.seterr(invalid = "ignore")
10571057

1058+
const pyisnone = if isdefined(PythonCall, :pyisnone)
1059+
PythonCall.pyisnone
1060+
else
1061+
PythonCall.Core.pyisnone
1062+
end
1063+
10581064
PythonPlot.ioff() # we don't want every command to update the figure
10591065
end
10601066
_runtime_init(::PythonPlotBackend) = nothing

src/backends/pythonplot.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ _py_renderer(fig) = _py_canvas(fig).get_renderer()
208208
_py_drawfig(fig) = fig.draw(_py_renderer(fig))
209209

210210
# `get_points` returns a numpy array in the form [x0 y0; x1 y1] coords (origin is bottom-left (0, 0)!)
211-
_py_extents(obj) = PythonCall.PyArray(obj.get_window_extent().get_points())
211+
_py_extents(obj) = PythonPlot.PyArray(obj.get_window_extent().get_points())
212212

213213
# see cjdoris.github.io/PythonCall.jl/stable/conversion-to-julia/#py2jl-conversion
214-
to_vec(x) = PythonCall.pyconvert(Vector, x)
215-
to_str(x) = PythonCall.pyconvert(String, x)
214+
to_vec(x) = PythonPlot.pyconvert(Vector, x)
215+
to_str(x) = PythonPlot.pyconvert(String, x)
216216

217217
# compute a bounding box (with origin top-left), however PythonPlot gives coords with origin bottom-left
218218
function _py_bbox(obj)
219-
PythonCall.pyisnone(obj) && return _py_bbox(nothing)
219+
pyisnone(obj) && return _py_bbox(nothing)
220220
fl, fr, fb, ft = bb = _py_extents(obj.get_figure())
221221
l, r, b, t = ex = _py_extents(obj)
222222
# @show obj bb ex
@@ -912,7 +912,7 @@ function _before_layout_calcs(plt::Plot{PythonPlotBackend})
912912
(cmap = func(cbar_series)) === nothing || break
913913
end
914914
c_map = mpl.cm.ScalarMappable(; cmap, norm)
915-
c_map.set_array(PythonCall.pylist([]))
915+
c_map.set_array(PythonPlot.pylist([]))
916916
c_map
917917
else
918918
cbar_series[:serieshandle][end]

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const TEST_BACKENDS = :gr, :unicodeplots, :pythonplot, :pgfplotsx, :plotlyjs, :g
2929
unicodeplots()
3030
pgfplotsx()
3131
plotlyjs()
32-
plotly()
3332
hdf5()
3433
gr()
3534

test/test_output.jl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,22 @@ Plots.with(:unicodeplots) do
4646
end
4747
end
4848

49-
Plots.with(:plotlyjs) do
50-
@test_save :html
51-
@test_save :json
52-
@test_save :pdf
53-
@test_save :png
54-
@test_save :svg
55-
# @test_save :eps
56-
end
49+
if Sys.isunix()
50+
Plots.with(:plotlyjs) do
51+
@test_save :html
52+
@test_save :json
53+
@test_save :pdf
54+
@test_save :png
55+
@test_save :svg
56+
# @test_save :eps
57+
end
5758

58-
Plots.with(:plotly) do
59-
@test_save :pdf
60-
@test_save :png
61-
@test_save :svg
62-
@test_save :html
59+
Plots.with(:plotly) do
60+
@test_save :pdf
61+
@test_save :png
62+
@test_save :svg
63+
@test_save :html
64+
end
6365
end
6466

6567
if Sys.islinux() && Sys.which("pdflatex") nothing

test/test_plotly.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Plots, Test
2-
Plots.with(:plotly) do
2+
Sys.isunix() && Plots.with(:plotly) do
33
@testset "Basic" begin
44
@test backend() == Plots.PlotlyBackend()
55

test/test_quality.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@testset "Auto QUality Assurance" begin
22
# JuliaTesting/Aqua.jl/issues/77
33
# TODO: fix :Contour, :Latexify and :LaTeXStrings stale imports in Plots 2.0
4-
# :PyCall and :Conda stale deps show up when running CI
4+
# :Conda stale deps show up when running CI
55
Aqua.test_all(
66
Plots;
77
stale_deps = (;

0 commit comments

Comments
 (0)