Skip to content

Commit 43f2d85

Browse files
committed
pyprefs
1 parent 1e8658a commit 43f2d85

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

PyPreferences.jl/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1212
VersionParsing = "81def892-9a0e-5fdd-b105-ffc91e053289"
1313

1414
[compat]
15+
Conda = "1"
1516
julia = "1.6"
17+
VersionParsing = "1"
18+
Preferences = "1"
1619

1720
[extras]
1821
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

PyPreferences.jl/src/core.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ end
1616

1717

1818
set(; python = nothing, inprocess = false, conda = false) =
19-
set(PythonPreferences(get_python_fullpath(python), inprocess, conda))
19+
set(PythonPreferences(python, inprocess, conda))
2020

2121
function set(prefs::PythonPreferences)
2222
@debug "setting new Python Preferences" prefs
2323
if prefs.python === nothing
2424
@delete_preferences!("python")
2525
else
26-
@set_preferences!("python" => prefs.python)
26+
@set_preferences!("python" => get_python_fullpath(prefs.python))
2727
end
2828
if prefs.inprocess
2929
@set_preferences!("inprocess" => prefs.inprocess)
@@ -51,7 +51,15 @@ function _load_python_preferences()
5151
_inprocess = @load_preference("inprocess", false)
5252
_conda = @load_preference("conda", false)
5353
#isempty(rawprefs) && return nothing
54-
return PythonPreferences(_python, _inprocess, _conda)
54+
55+
# default value
56+
if !_inprocess && !_conda && _python === nothing
57+
_python = get_python_fullpath(get_default_python())
58+
@info "Setting default Python interpreter to $(_python)"
59+
return set(python=_python)
60+
else
61+
return PythonPreferences(_python, _inprocess, _conda)
62+
end
5563
end
5664

5765
function load_pypreferences_code()

0 commit comments

Comments
 (0)