Skip to content

Commit

Permalink
Move precompile statements to PlutoRunner (#2778)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw committed Jan 22, 2024
1 parent 4ef3c4f commit b46dd6a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
precompile.jl
build
Manifest.toml

Expand Down
12 changes: 0 additions & 12 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
using PrecompileTools: PrecompileTools

const __TEST_NOTEBOOK_ID = uuid1()

PrecompileTools.@compile_workload begin
let
channel = Channel{Any}(10)
Pluto.PlutoRunner.setup_plutologger(
__TEST_NOTEBOOK_ID,
channel,
)
end
expr = Expr(:toplevel, :(1 + 1))
Pluto.PlutoRunner.run_expression(Module(), expr, __TEST_NOTEBOOK_ID, uuid1(), nothing);

nb = Pluto.Notebook([
Pluto.Cell("""md"Hello *world*" """)
Pluto.Cell("""[f(x)]""")
Expand Down
2 changes: 2 additions & 0 deletions src/runner/PlutoRunner/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
FuzzyCompletions = "0.3,0.4,0.5"
PrecompileTools = "1"
2 changes: 2 additions & 0 deletions src/runner/PlutoRunner/src/PlutoRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2699,4 +2699,6 @@ function setup_plutologger(notebook_id::UUID, log_channel::Channel{Any})
pluto_log_channels[notebook_id] = log_channel
end

include("./precompile.jl")

end
20 changes: 20 additions & 0 deletions src/runner/PlutoRunner/src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using PrecompileTools: PrecompileTools
using UUIDs: uuid1

const __TEST_NOTEBOOK_ID = uuid1()

PrecompileTools.@compile_workload begin
let
channel = Channel{Any}(10)
PlutoRunner.setup_plutologger(
__TEST_NOTEBOOK_ID,
channel,
)
end
expr = Expr(:toplevel, :(1 + 1))
cell_id = uuid1()
workspace = Module()
PlutoRunner.run_expression(workspace, expr, __TEST_NOTEBOOK_ID, cell_id, nothing);
PlutoRunner.formatted_result_of(__TEST_NOTEBOOK_ID, cell_id,
false, String[], nothing, workspace; capture_stdout=true)
end

0 comments on commit b46dd6a

Please sign in to comment.