forked from livebook-dev/pythonx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.ex
More file actions
29 lines (23 loc) · 736 Bytes
/
Copy pathapplication.ex
File metadata and controls
29 lines (23 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
defmodule Pythonx.Application do
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
Pythonx.Janitor
]
opts = [strategy: :one_for_one, name: Pythonx.Supervisor]
with {:ok, result} <- Supervisor.start_link(children, opts) do
maybe_uv_init()
{:ok, result}
end
end
# If configured, we fetch Python and dependencies at compile time
# and we automatically initialize the interpreter on boot.
if pyproject_toml = Application.compile_env(:pythonx, :uv_init)[:pyproject_toml] do
Pythonx.Uv.fetch(pyproject_toml, true)
defp maybe_uv_init(), do: Pythonx.Uv.init(unquote(pyproject_toml), true)
else
defp maybe_uv_init(), do: :noop
end
end