Skip to content

Commit 84d9770

Browse files
committed
Use nested configuration for uv
1 parent 8d4e28e commit 84d9770

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,16 @@ Configure the desired Python version and dependencies in your
104104
```elixir
105105
import Config
106106

107-
config :pythonx, :uv_pyproject_toml, """
108-
[project]
109-
name = "project"
110-
version = "0.0.0"
111-
requires-python = "==3.13.*"
112-
dependencies = [
113-
"numpy==2.2.2"
114-
]
115-
"""
107+
config :pythonx, :uv,
108+
pyproject_toml: """
109+
[project]
110+
name = "project"
111+
version = "0.0.0"
112+
requires-python = "==3.13.*"
113+
dependencies = [
114+
"numpy==2.2.2"
115+
]
116+
"""
116117
```
117118

118119
With that, you can use `Pythonx.eval/2` and other APIs in your

lib/pythonx/application.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ defmodule Pythonx.Application do
2020

2121
# If configured, Python and dependencies are fetched at compile time,
2222
# so we automatically initialize the interpreter on boot.
23-
if pyproject_toml = Application.compile_env(:pythonx, :uv_pyproject_toml) do
23+
if pyproject_toml = Application.compile_env(:pythonx, :uv)[:pyproject_toml] do
2424
defp maybe_uv_init(), do: Pythonx.Uv.init(unquote(pyproject_toml), true)
2525
else
2626
defp maybe_uv_init(), do: :noop
2727
end
2828
end
2929

3030
# If configured, fetch Python and dependencies when compiling.
31-
if pyproject_toml = Application.compile_env(:pythonx, :uv_pyproject_toml) do
31+
if pyproject_toml = Application.compile_env(:pythonx, :uv)[:pyproject_toml] do
3232
Pythonx.Uv.fetch(pyproject_toml, true)
3333
end

0 commit comments

Comments
 (0)