Skip to content

Commit

Permalink
Fix compilation failure on Julia 1.10 (#6)
Browse files Browse the repository at this point in the history
* Require explicit `.start()` to fix Julia 1.10

* Turn off `test_nowarn` for import

* Turn off breaking change warning
  • Loading branch information
MilesCranmer authored Aug 10, 2023
1 parent c8da53c commit d0c390c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlotlyKaleido"
uuid = "f2990250-8cf9-495f-b13a-cce12b45703c"
authors = ["Simon Christ <christ@cell.uni-hannover.de>", "Spencer Lyon <spencerlyon2@gmail.com>"]
version = "1.0.0"
version = "2.0.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ This code was originally part of [PlotlyJS.jl](https://github.com/JuliaPlots/Plo

```julia
using PlotlyKaleido

import PlotlyLight, EasyConfig, PlotlyJS

PlotlyKaleido.start() # start Kaleido server

p1 = PlotlyLight.Plot(EasyConfig.Config(x = rand(10)))

p2 = PlotlyJS.plot(PlotlyJS.scatter(x = rand(10)))
Expand All @@ -35,3 +36,15 @@ p2 = PlotlyJS.plot(PlotlyJS.scatter(x = rand(10)))
PlotlyKaleido.savefig(p1, "plot1.png")
PlotlyKaleido.savefig(p2, "plot2.png")
```

If needed, you can restart the server:

```julia
PlotlyKaleido.restart()
```

or simply kill it:

```julia
PlotlyKaleido.kill_kaleido()
```
6 changes: 2 additions & 4 deletions src/PlotlyKaleido.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ using Kaleido_jll

export savefig

__init__() = start()

#-----------------------------------------------------------------------------# Kaleido Process
mutable struct Pipes
stdin::Pipe
Expand All @@ -19,11 +17,11 @@ end

const P = Pipes()

kill() = is_running() && kill(P.proc)
kill_kaleido() = is_running() && kill(P.proc)

is_running() = isdefined(P, :proc) && isopen(P.stdin) && process_running(P.proc)

restart() = (kill(); start())
restart() = (kill_kaleido(); start())

function start()
is_running() && return
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Test
@test_nowarn @eval using PlotlyKaleido

PlotlyKaleido.start()

import PlotlyLight, EasyConfig, PlotlyJS

@testset "Saving JSON String" begin
Expand Down

2 comments on commit d0c390c

@BeastyBlacksmith
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89368

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.0 -m "<description of version>" d0c390c6ade6c65bdccb1e680116e93a826b2541
git push origin v2.0.0

Please sign in to comment.