Skip to content

Commit

Permalink
a couple of cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
schlichtanders committed Aug 12, 2024
1 parent b6d2e46 commit 37788b2
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 480 deletions.
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JolinPluto"
uuid = "5b0b4ef8-f4e6-4363-b674-3f031f7b9530"
authors = ["Stephan Sahm <[email protected]> and contributors"]
version = "0.1.79"
version = "0.1.80"

[deps]
AbstractPlutoDingetjes = "6e696c72-6542-2067-7265-42206c756150"
Expand All @@ -18,15 +18,11 @@ JWTs = "d850fbd6-035d-5a70-a269-1ca2e636ac6c"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[weakdeps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"

[extensions]
AWSExt = "AWS"
PlotsExt = "Plots"
PythonCallExt = "PythonCall"
RCallExt = ["RCall", "CondaPkg"]

Expand Down
95 changes: 0 additions & 95 deletions ext/AWSExt.jl

This file was deleted.

34 changes: 18 additions & 16 deletions ext/PlotsExt.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
module PlotsExt
import JolinPluto, Plots

# little helper to support plotly responsiveness
# see this issue for updates https://github.com/JuliaPlots/Plots.jl/issues/4775
function JolinPluto.plotly_responsive(plt=Plots.current())
HTML("<div>" * replace(
Plots.embeddable_html(plt),
# adapt margin as it interfers with responsive
r"\"margin\": \{[^\}]*\},"s => """
"margin": {"l": 40,"b": 40,"r": 0,"t": 22},""",
# delete extra outer style attribute - not needed at all
r"style=\"[^\"]*\""s => "",
# delete layout width as this interfers with responsiveness
r"\"width\":[^,}]*"s => "",
# add extra config json at the end of the call to Plotly.newPlot
");" => ", {\"responsive\": true});"
) * "</div>")
end
# TODO use PlutoPlotly.jl instead

# # little helper to support plotly responsiveness
# # see this issue for updates https://github.com/JuliaPlots/Plots.jl/issues/4775
# function JolinPluto.plotly_responsive(plt=Plots.current())
# HTML("<div>" * replace(
# Plots.embeddable_html(plt),
# # adapt margin as it interfers with responsive
# r"\"margin\": \{[^\}]*\},"s => """
# "margin": {"l": 40,"b": 40,"r": 0,"t": 22},""",
# # delete extra outer style attribute - not needed at all
# r"style=\"[^\"]*\""s => "",
# # delete layout width as this interfers with responsiveness
# r"\"width\":[^,}]*"s => "",
# # add extra config json at the end of the call to Plotly.newPlot
# ");" => ", {\"responsive\": true});"
# ) * "</div>")
# end

end
8 changes: 6 additions & 2 deletions ext/PythonCallExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end
function JolinPluto.start_python_thread(func)
threading = @pyconst(pyimport("threading"))

if !JolinPluto.is_running_in_pluto_process()
if !JolinPluto.is_running_in_jolinpluto_process()
# just start a plain thread without cleanup
stop_event = threading.Event()
threading.Thread(target=func, daemon=true, args=(stop_event,)).start()
Expand Down Expand Up @@ -58,8 +58,12 @@ end
pyglobals() = get!(PythonCall.pydict, PythonCall.Core.MODULE_GLOBALS, Main)

JolinPluto.lang_enabled(::Val{:py}) = true
function JolinPluto.lang_copy_bind(::Val{:py}, def, value)
function JolinPluto.lang_set_global(::Val{:py}, def, value)
pyglobals()[string(def)] = value
end
function JolinPluto.lang_get_global(::Val{:py}, def)
pyglobals()[string(def)]
end


end
5 changes: 4 additions & 1 deletion ext/RCallExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ end
# c(MD, HTML, format_html, viewof) %<-% julia_eval("Jolin.MD, Jolin._HTML, Jolin.format_html, Jolin.viewof")

JolinPluto.lang_enabled(::Val{:r}) = true
function JolinPluto.lang_copy_bind(::Val{:r}, def::Symbol, value)
function JolinPluto.lang_set_global(::Val{:r}, def::Symbol, value)
RCall.Const.GlobalEnv[def] = value
end
function JolinPluto.lang_get_global(::Val{:r}, def::Symbol)
RCall.Const.GlobalEnv[def]
end

function __init__()
# this is crucial so that the path is set correctly
Expand Down
8 changes: 2 additions & 6 deletions src/JolinPluto.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
module JolinPluto

# we use macros for everything, releasing mental load
export @get_jwt, @authorize_aws
export get_jwt, authorize_aws
export @repeat_take!, @repeat_at, @repeat_run, @Channel
export repeat_take!, repeat_take, repeat_at, repeat_run, ChannelPluto, repeat_queueget, ChannelWithRepeatedFill, NoPut, start_python_thread
export @output_below, @clipboard_image_to_clipboard_html
export output_below, clipboard_image_to_clipboard_html, embedLargeHTML, plotly_responsive
export Setter, @get, @cell_ids_create_wrapper, @cell_ids_push!
export cell_ids_create_wrapper, cell_ids_push!, cell_ids_push
Expand All @@ -17,10 +13,10 @@ using HypertextLiteral, Continuables
import AbstractPlutoDingetjes

include("plutohooks_basics.jl")
include("authorize.jl")
include("viewof.jl")
include("tasks.jl")
include("frontend.jl")
include("setter.jl")
include("frontend.jl")
include("languages.jl")

end # module
121 changes: 0 additions & 121 deletions src/authorize.jl

This file was deleted.

Loading

0 comments on commit 37788b2

Please sign in to comment.