LiveBook App in "local preview" sources config file from wrong directory?

Hi

I am using Livebook together with a mix project like this;
Mix.install(
[
{:gf_app, path: Path.join(DIR, “…”), env: :dev},
{:kino, “~> 0.14.2”},
… more dependencies …
],
lockfile: :gf_app,
config_path: :gf_app
)

Works great until I try to deploy as a local app using “local preview”. At that point, LB attempts to get config files from the autosave path…

** (File.Error) could not read file “/Users/xxx/Library/Application Support/livebook/autosaved/2024_12_05/config/config.exs”: no such file or directory
(elixir 1.17.2) lib/file.ex:385: File.read!/1
(elixir 1.17.2) lib/config/reader.ex:110: Config.Reader.read_imports!/2
(mix 1.17.2) lib/mix/tasks/loadconfig.ex:56: Mix.Tasks.Loadconfig.load_compile/1
(mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.17.2) lib/mix.ex:913: anonymous fn/5 in Mix.install/2
(elixir 1.17.2) lib/file.ex:1665: File.cd!/2
(mix 1.17.2) lib/mix.ex:911: Mix.install/2
#cell:setup:1: (file)

Any idea of how to get this to work?

Thanks In advance!

Hey @TAS, this behaviour is expected since the app is not tied to the deployed notebook location. One thing you can do is store the path to app in a secret (or regular env var) and read it from there.

Thanks @jonatanklosko. I will try that. What I am really looking for is to hide the code cells and just show md text and kino UI elements and basically run the live-book in a “dynamic presentation mode” to explore some complex modeling scenarios where the code itself just becomes a distraction. After reading PR #2798 it seems like a good fit.

Added in Add custom view option to hide code by jonatanklosko · Pull Request #2889 · livebook-dev/livebook · GitHub : )

Awesome!!!

1 Like