Skip to content

Commit

Permalink
Add Kino.beam_paths/0 (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Jun 7, 2024
1 parent 65a88f6 commit 93d042a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/kino.ex
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,18 @@ defmodule Kino do
end
end

@doc """
Returns the directories that contain `.beam` files for modules
defined in the notebook.
"""
@spec beam_paths() :: list(String.t())
def beam_paths() do
case Kino.Bridge.get_beam_paths() do
{:ok, paths} -> paths
_ -> []
end
end

@doc """
Recompiles dependenies.
Expand Down
8 changes: 8 additions & 0 deletions lib/kino/bridge.ex
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ defmodule Kino.Bridge do
with {:ok, reply} <- io_request(:livebook_get_tmp_dir), do: reply
end

@doc """
Returns directories with `.beam` files tied to the current runtime.
"""
@spec get_beam_paths() :: {:ok, String.t()} | {:error, :not_available} | request_error()
def get_beam_paths() do
with {:ok, reply} <- io_request(:livebook_get_beam_paths), do: reply
end

@doc """
Starts monitoring clients presence from the given process.
Expand Down

0 comments on commit 93d042a

Please sign in to comment.