juliapackaging / preferences.jl Goto Github PK
View Code? Open in Web Editor NEWProject Preferences Package
License: Other
Project Preferences Package
License: Other
It seems to me that LocalPreferences.toml
don't have any effect if the package I am setting the dependency in isn't listed as a direct dependency.
I prepared a small example: prefs.tar.gz
A
is the package using Preferences.jl to manage a "backend"B
is using A
C
is using B
vchuravy@odin ~/s/prefs> cat B/LocalPreferences.toml
[A]
backend = "CUDA"
vchuravy@odin ~/s/prefs> cat C/LocalPreferences.toml
[A]
backend = "CUDA"
vchuravy@odin ~/s/prefs> julia --project=B -e "using B; @show B.active_backend()"
B.active_backend() = "CUDA"
vchuravy@odin ~/s/prefs> julia --project=C -e "using B; @show B.active_backend()"
B.active_backend() = "OpenCL"
Both have the same LocalPreferences.toml
After adding A
to C
as a dependency things seem to work. But this is problematic for several use-cases of Preferences. I found this the first time when I wanted to change the path of a library in a jll
package.
Would it be possible to have an Preferences.@load_preference_parse
which parses strings into the Julia objects?
Came up in SciML/SciMLBase.jl#252 (review) @devmotion
I'm using Julia 1.5.2. When I install and use this library, I got an error about TOMLCache. Here is the stacktrace:
(@v1.5) pkg> add Preferences
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
[ Warning: julia version requirement for project not satisfied
julia version requirement for package `Example [227d26fe]` not satisfied
Installed Preferences ─ v1.2.1
Updating `~/work/Example/Project.toml`
[21216c6a] + Preferences v1.2.1
Updating `~/work/Example/Manifest.toml`
[21216c6a] + Preferences v1.2.1
[8f1865be] ↑ ZeroMQ_jll v4.3.2+5 ⇒ v4.3.2+6
[a9144af2] + libsodium_jll v1.0.18+1
julia> using Preferences
[ Info: Precompiling Preferences [21216c6a-2e73-6563-6e65-726566657250]
ERROR: LoadError: UndefVarError: TOMLCache not defined
Looks like prefs
should be pref_keys
here, otherwise getting the error
ERROR: UndefVarError: prefs not defined
Stacktrace:
[1] #delete_preferences!#18
@ ~/.julia/packages/Preferences/SHSJJ/src/Preferences.jl:274 [inlined]
[2] top-level scope
@ REPL[10]:1
The delete_preferences
docstring says "See the docstring for set_preferences!
for more details" but it seems block_inheritance
is specific to delete_preferences
How to make global preferences for a package? I tried putting them to ~/.julia/environments/v1.7/Project.toml
, but they are only available when this environment is in the LOAD_PATH. Code running from tests or from Pluto notebooks doesn't have this load path entry, so those preferences are unavailable.
I'm talking about machine-specific preferences, like some system directory path, or hardware-related settings. They seem to be a good fit for Preferences.jl, but such preferences should always be available in order to make sense at all.
I think it would be nice to be able to set preferences for Applications (as opposed to packages). Could that make sense?
Since Applications do not have name or uuids (not necessarily), these preferences could be stored at the top level of the LocalPreferences.toml file, and be associated to the current leaf project. We could set/get them by unqualified set_preferences!(key => value)
and get_preferences(key)
(without having to specify UUID or a package name).
APP_KEY1 = "value1" # current app preferences
[PkgA] # package specific preferences
CONF_PKG_A_KEY1 = "abc"
# ...
I am sorry in advance, perhaps I misunderstood some things. But from my experiments with this package (and some explanations given in zulip), it seems that it stores LocalPreferences.toml
roughly in ~/.julia/environments/v1.7/LocalPreferences.toml
(of course instead of v1.7
there can be any other julia version).
This looks somewhat inconvenient since packages version do not correlate with Julia version and the same config can be used between different Julia version. But in current implementation, each time user install new Julia version, he should move/recreate preferences again, despite the fact that packages configuration hasn't change at all.
To illustrate my concern, here is the possible scenario:
using Foo; set_prefs(foo = "bar")
where set_prefs
is a function provided by Foo
package.Foo
knows that foo = "bar"
.using Foo
and I can see that instead of foo = "bar"
i get foo = "default"
. And this is kind of unexpected, because my settings of package Foo
was not related to Julia version.Of course one can recreate all settings, but if many packages uses this mechanism it can be quite a task.
Another option is to manually copy LocalPreferences.toml
between Julia versions, but it looks hackish and low level.
Instead, this file can be saved in ~/.julia/environments
or ~/.julia/prefs
and none of this problems appear.
P.S.: The way how I get this result:
] generate Foo
Foo
directory I've added Preferences.jl with julia --project=.
and ] add Preferences
Foo
package was added in Julia environment with ] dev Foo
function set_username(username::String)
@set_preferences!("username" => username)
end
julia --project=.
and used using Foo; Foo.set_username("foobar")
LocalPreferences.toml
appeared in ~/.julia/environments/v1.7
@staticfloat Can we register Preferences.jl in the General registry?
In JuliaParallel/MPI.jl#570 we noticed that the target of set_preferences
is not the current active project,
but the project that contains the package in it's Project.toml.
The text in
Preferences.jl/src/Preferences.jl
Lines 188 to 191 in 80b5509
is a bit confusing since it seemingly implies that => nothing
will set at a lower level (e.g. the current Project) a clear project, but instead it is also targeting the Project higher up in the LOAD_PATH.
Should we just always target the current Project?
cc: @staticfloat
Testing Running tests...
Precompiling Preferences...
1 dependency successfully precompiled in 1 seconds. 4 already precompiled.
Preferences: Test Failed at /home/nsajko/.julia/packages/Preferences/enLcN/test/runtests.jl:94
Expression: did_precompile(output)
Stacktrace:
[1] macro expansion
@ ~/tmp/jl/jl/julia-1.11.0-beta1/share/julia/stdlib/v1.11/Test/src/Test.jl:679 [inlined]
[2] (::var"#8#9"{String})()
@ Main ~/.julia/packages/Preferences/enLcN/test/runtests.jl:94
[3] (::var"#1#2"{var"#8#9"{String}})(dir::String)
@ Main ~/.julia/packages/Preferences/enLcN/test/runtests.jl:20
[4] mktempdir(fn::var"#1#2"{var"#8#9"{String}}, parent::String; prefix::String)
@ Base.Filesystem ./file.jl:819
[5] mktempdir (repeats 2 times)
@ ./file.jl:815 [inlined]
[6] with_temp_depot(f::var"#8#9"{String})
@ Main ~/.julia/packages/Preferences/enLcN/test/runtests.jl:15
[7] macro expansion
@ ~/.julia/packages/Preferences/enLcN/test/runtests.jl:57 [inlined]
[8] macro expansion
@ ~/tmp/jl/jl/julia-1.11.0-beta1/share/julia/stdlib/v1.11/Test/src/Test.jl:1700 [inlined]
[9] top-level scope
@ ~/.julia/packages/Preferences/enLcN/test/runtests.jl:55
Test Summary: | Pass Fail Total Time
Preferences | 37 1 38 54.3s
ERROR: LoadError: Some tests did not pass: 37 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/nsajko/.julia/packages/Preferences/enLcN/test/runtests.jl:53
ERROR: Package Preferences errored during testing
The test:
Preferences.jl/test/runtests.jl
Lines 87 to 94 in 30889fe
Can we get a new release? The docs are in the README, so it reflects the current "development" stage of the package, which is 8 commits ahead of master
and fixes bugs that I'm experiencing when I use the package as recommended in the README.
This:
@load_preference(key; default = nothing)
Gives the following error:
ERROR: LoadError: LoadError: syntax: invalid syntax ; default = nothing
In contrast, this works just fine:
@load_preference(key, default = nothing)
Would it be possible to support the version of the syntax with the semicolon (i.e. @load_preference(key; default = nothing)
? It would be consistent with one of the main ways of using keyword arguments in functions.
In one of my packages, say PkgA
, I would like to set a preference for one of its dependencies, say PkgB
. I did so by setting the preference key-value-pair in PkgA/Project.toml
. When I activate the env of PkgA
this does what I want. However, when I depend on PkgA
in another package, say PkgC
(which does not have any preferences set at all), then the preference I specified in the PkgA/Project.toml
for PkgB
's config value is not loaded. Is there a way to achieve this or is this beyond the (current) scope of this package?
It looks like the preference reading part that is defined in Base is completely untested there. That makes it easy to introduce a mistake that won't be caught until someone runs the Preferences test on master. It would be good if (just like code loading) there were dedicated tests for reading preferences in Base to avoid regressions.
Currently the documentation only explains how developers should use the package, but users also need to know how to use it to update preferences. It took me some troubleshooting to figure it out. I think it needs to document the following 2 ways:
set_preferences!
: this requires the user launch a new Julia session if developers implemented preferences with a const
like in the ReadMe.LocalPreferences.toml
in the user's environmentIt should note that neither of these work with temporary environments, since relaunching loses the environment.
It may happen that the installation of a package is read-only.
In this case, set_preferences!
runs into an error when it tries to create a LocalPreferences.toml
file.
In a new installation, not having installed packages (e.g. only having used --project
) the directory .julia/environments/vX.Y
does not exist:
ERROR: LoadError: SystemError: opening file "/home/tim/.julia/environments/v1.8/Project.toml": No such file or directory
Stacktrace:
[1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
@ Base ./error.jl:176
[2] #systemerror#79
@ ./error.jl:175 [inlined]
[3] systemerror
@ ./error.jl:175 [inlined]
[4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
@ Base ./iostream.jl:293
[5] open
@ ./iostream.jl:282 [inlined]
[6] open(f::Base.var"#384#385"{Tuple{}}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:382
[7] open
@ ./io.jl:382 [inlined]
[8] read
@ ./io.jl:460 [inlined]
[9] Base.CachedTOMLDict(p::Base.TOML.Parser, path::String)
@ Base ./loading.jl:218
[10] (::Base.var"#892#893"{String, Base.TOMLCache})()
@ Base ./loading.jl:276
[11] lock(f::Base.var"#892#893"{String, Base.TOMLCache}, l::ReentrantLock)
@ Base ./lock.jl:185
[12] parsed_toml
@ ./loading.jl:273 [inlined]
[13] parsed_toml
@ ./loading.jl:271 [inlined]
[14] set_preferences!(u::Base.UUID, prefs::Pair{String, String}; export_prefs::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Preferences ~/.julia/packages/Preferences/TJoW1/src/Preferences.jl:213
[15] set_preferences!
@ ~/.julia/packages/Preferences/TJoW1/src/Preferences.jl:198 [inlined]
[16] #set_preferences!#11
@ ~/.julia/packages/Preferences/TJoW1/src/Preferences.jl:241 [inlined]
[17] set_preferences!(m::Module, prefs::Pair{String, String})
@ Preferences ~/.julia/packages/Preferences/TJoW1/src/Preferences.jl:241
[18] set_preferences(mod::Module, entries::Dict{Any, Any})
@ Main /tmp/oneAPI.jl/res/local.jl:75
[19] top-level scope
@ /tmp/oneAPI.jl/res/local.jl:79
one can create a package to test this, the Project.toml looks like following
name = "PkgModule"
uuid = "81468456-a077-41e9-90c9-0e047517ca6f"
authors = ["Roger-Luo <[email protected]> and contributors"]
version = "0.1.0"
[deps]
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
[compat]
julia = "1.6.1"
[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[preferences.PkgModule.color]
name = "light_blue"
[targets]
test = ["Test"]
the src/PkgModule.jl
looks like this
module PkgModule
using Preferences
# uncomment the following to reproduce error
# const color = @load_preference("color")
# const color = load_preference(PkgModule, "color")
end
while I'm expecting color to be loaded as a Dict
, but I'm getting
julia> using PkgModule
[ Info: Precompiling PkgModule [81468456-a077-41e9-90c9-0e047517ca6f]
fatal: error thrown and no exception handler available.
TypeError(func=:typeassert, context="", expected=Union{Nothing, String}, got=Base.Dict{String, Any}(slots=Array{UInt8, (16,)}[0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], keys=Array{String, (16,)}[
#<null>,
"name",
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>], vals=Array{Any, (16,)}[
#<null>,
"light_blue",
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>,
#<null>], ndel=0, count=1, age=0x0000000000000001, idxfloor=2, maxprobe=0))
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:119
jl_type_error at /buildworker/worker/package_linux64/build/src/rtutils.c:127
get_preferences_hash at ./loading.jl:1662
get_preferences_hash at ./loading.jl:1671
jfptr_get_preferences_hash_50003.clone_1 at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
write_dependency_list at /buildworker/worker/package_linux64/build/src/dump.c:1150 [inlined]
jl_save_incremental at /buildworker/worker/package_linux64/build/src/dump.c:2139
jl_write_compiler_output at /buildworker/worker/package_linux64/build/src/precompile.c:65
jl_atexit_hook at /buildworker/worker/package_linux64/build/src/init.c:211
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:703
main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:51
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/bin/julia (unknown line)
ERROR: Failed to precompile PkgModule [81468456-a077-41e9-90c9-0e047517ca6f] to /home/roger/.julia/compiled/v1.6/PkgModule/jl_84dbrq.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
@ Base ./loading.jl:1360
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1306
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1021
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:914
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:901
[7] eval
@ ./boot.jl:360 [inlined]
[8] eval
@ ./Base.jl:39 [inlined]
[9] repleval(m::Module, code::Expr, #unused#::String)
@ VSCodeServer ~/.vscode-server/extensions/julialang.language-julia-1.2.5/scripts/packages/VSCodeServer/src/repl.jl:149
however, this works with using Preference in the REPL
julia> using Preferences
julia> load_preference(PkgModule, "color")
Dict{String, Any} with 1 entry:
"name" => "light_blue"
ERROR: MethodError: no method matching load_preference(::Module, ::SubString{String})
Closest candidates are:
load_preference(::Module, ::String) at C:\Users\Stuart.julia\packages\Preferences\TJoW1\src\Preferences.jl:35
load_preference(::Module, ::String, ::Any) at C:\Users\Stuart.julia\packages\Preferences\TJoW1\src\Preferences.jl:35
Perhaps just needs to use AbstractString instead of String ?
This came up in the context of CUDA.jl:
JuliaGPU/CUDA.jl#1922 (comment)
To use a non-artifact/system-wide CUDA installation, the "official" way it to use
CUDA.set_runtime_version!("local")
but that results in a multi-GB download of the CUDA runtime artifacts, only to then switch to not using them. As an alternative, one can use
Preferences.set_preferences!(CUDA_Runtime_jll, "version" => "local")
But to do that, CUDA_Runtime_jll needs to be loaded first - since it's a low-level package, it's much better of in the [extras]
section of the current project then in it's direct dependencies. But it its now a direct dependency, it can't be loaded directly, so we don't have access to the CUDA_Runtime_jll
object. But what about using the UUID of CUDA_Runtime_jll? That'll would do the trick:
Preferences.set_preferences!(Base.UUID("76a88914-d11a-5bdc-97e0-2f5a05c973a2"), "version" => "local")
it's set's the preference and would add CUDA_Runtime_jll to [extras]
automatically. But it's not that easy because what happens is
julia> Preferences.set_preferences!(Base.UUID("76a88914-d11a-5bdc-97e0-2f5a05c973a2"), "version" => "local")
ERROR: Cannot set preferences of an unknown package that is not loaded!
It does work, however, if CUDA_Runtime_jll is already in the [extras]
section of the current project. So it's a bit of a chicken-and-egg problem, and the only way seems to be adding CUDA_Runtime_jll to [extras]
manually. That makes it hard to provide simple set-up commands/scripts for systems to users, especially if they don't have much Julia experience yet (tutorial scenarios, etc.). Unfortunately there seems to be no user-accessible functionality in Pkg
that adds a dependency to [extras]
instead of [deps]
.
Maybe we could add allow
Preferences.set_preferences!("CUDA_Runtime_jll", "version" => "local")
as well? It could warn that the package hasn't been installed yet and add it to [extras]
(and set the preference(s), of course).
Or maybe this is already possible in some other way with Preferences?
CC @vchuravy
I encounter this bug on Julia 1.7.3. Julia 1.8.0-rc1 does not have this.
Here's MWE: R.tar.gz
The package is very minimal, it only loads preference const BACKEND = @load_preference("backend")
from LocalPreferences.toml
.
When using R
directly, it loads preferences, but when ]test
ing package, BACKEND
is nothing
.
Tracing what happens during @load_preference
I've found out that project_dir
does not contain LocalPreferences.toml
:
1.7.3
: readdir(project_dir) = ["Manifest.toml", "Project.toml"]
1.8.0-rc1
: readdir(project_dir) = ["JuliaLocalPreferences.toml", "Manifest.toml", "Project.toml"]
julia> set_preferences!(Plots, "default_backend" => :plotly)
ERROR: type `Symbol` is not a valid TOML type, pass a conversion function to `TOML.print`
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] _print(f::Nothing, io::IOStream, a::Dict{String, Any}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer ~/.asdf/installs/julia/1.8.0/share/julia/stdlib/v1.8/TOML/src/print.jl:112
[3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:indent, :first_block, :sorted, :by), Tuple{Int64, Bool, Bool, typeof(identity)}}})
@ Base ./essentials.jl:731
[4] _print(f::Nothing, io::IOStream, a::Dict{String, Any}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer ~/.asdf/installs/julia/1.8.0/share/julia/stdlib/v1.8/TOML/src/print.jl:147
[5] #print#15
@ ~/.asdf/installs/julia/1.8.0/share/julia/stdlib/v1.8/TOML/src/print.jl:170 [inlined]
[6] (::Preferences.var"#4#5")(io::IOStream)
@ Preferences ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:145
[7] open(::Preferences.var"#4#5", ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:384
[8] open
@ ./io.jl:381 [inlined]
[9] set_preferences!(target_toml::String, pkg_name::String, pairs::Pair{String, Symbol}; force::Bool)
@ Preferences ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:144
[10] set_preferences!
@ ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:115 [inlined]
[11] set_preferences!(u::Base.UUID, prefs::Pair{String, Symbol}; export_prefs::Bool, active_project_only::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Preferences ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:276
[12] set_preferences!
@ ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:205 [inlined]
[13] #set_preferences!#13
@ ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:279 [inlined]
[14] set_preferences!(m::Module, prefs::Pair{String, Symbol})
@ Preferences ~/.julia/packages/Preferences/VmJXL/src/Preferences.jl:278
[15] top-level scope
@ REPL[7]:1
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Now that Preferences is merged in Base, we should set up 1.6+ CI
Note that the package can be installed on Julia v1.0+ but is only functional on Julia v1.6+.
What is the rationale behind this?
It would be nice to have the ability to "delete" a preference.
Maybe the API could look like this:
@delete_preferences!(keys...)
Some tests started failing for us. It seems that Preferences.jl stopped working when invoked using ]test
? My module is
module PTest
using Preferences
function f(flag::Bool)
@set_preferences!("test" => flag)
f = @load_preference("test", default = nothing)
@assert !isnothing(f)
f
end
end # module PTest
The runtests.jl
file:
using Test, PTest
PTest.f(true)
Then doing ]test PTest
yields
ERROR: LoadError: AssertionError: !(isnothing(f))
Stacktrace:
[1] f(flag::Bool)
@ PTest ~/PTest/src/PTest.jl:8
[2] top-level scope
@ ~/PTest/test/runtests.jl:3
[3] include(fname::String)
@ Base.MainInclude ./client.jl:476
[4] top-level scope
@ none:6
in expression starting at /Users/bla/PTest/test/runtests.jl:3
ERROR: Package PTest errored during testing
Note that it works on julia 1.6, 1.7 and also when just run in the REPL.
julia> versioninfo()
Julia Version 1.9.0-DEV.122
Commit b4ea0f7c4b* (2022-03-03 08:32 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin20.6.0)
CPU: 8 × Apple M1
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
Threads: 1 on 8 virtual cores
Running
set_preferences!(Preferences, "a" => nothing; force=true)
set_preferences!(Preferences, "a" => "b"; force=true)
results in LocalPreferences.toml
[Preferences]
__clear__ = ["a"]
a = "b"
I would expect that the second call to set_preferences!
would completely undo the effect of the first call. Is this the intended behavior?
If I attempt to write an object that can't be represented by the TOML format, it can leave the cache in an invalid state:
julia> using Preferences
julia> set_preferences!(Preferences, "a" => 1) # set a key to initialize the cache
julia> set_preferences!(Preferences, "b" => v"1.0") # attempt to write an invalid object, throws an error
ERROR: type `VersionNumber` is not a valid TOML type, pass a conversion function to `TOML.print`
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] _print(f::Nothing, io::IOStream, a::Dict{String, Any}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/TOML/src/print.jl:112
...
julia> set_preferences!(Preferences, "c" => 1) # now write a valid object
ERROR: type `VersionNumber` is not a valid TOML type, pass a conversion function to `TOML.print`
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] _print(f::Nothing, io::IOStream, a::Dict{String, Any}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/TOML/src/print.jl:112
[3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:indent, :first_block, :sorted, :by), Tuple{Int64, Bool, Bool, typeof(identity)}}})
@ Base ./essentials.jl:731
[4] _print(f::Nothing, io::IOStream, a::Dict{String, Any}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/TOML/src/print.jl:147
[5] #print#15
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/TOML/src/print.jl:170 [inlined]
[6] (::Preferences.var"#4#5")(io::IOStream)
@ Preferences ~/.julia/dev/Preferences/src/Preferences.jl:145
[7] open(::Preferences.var"#4#5", ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:384
[8] open
@ ./io.jl:381 [inlined]
[9] set_preferences!(target_toml::String, pkg_name::String, pairs::Pair{String, Int64}; force::Bool)
@ Preferences ~/.julia/dev/Preferences/src/Preferences.jl:144
[10] set_preferences!
@ ~/.julia/dev/Preferences/src/Preferences.jl:115 [inlined]
[11] set_preferences!(u::Base.UUID, prefs::Pair{String, Int64}; export_prefs::Bool, active_project_only::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Preferences ~/.julia/dev/Preferences/src/Preferences.jl:283
[12] set_preferences!
@ ~/.julia/dev/Preferences/src/Preferences.jl:205 [inlined]
[13] #set_preferences!#13
@ ~/.julia/dev/Preferences/src/Preferences.jl:286 [inlined]
[14] set_preferences!(m::Module, prefs::Pair{String, Int64})
@ Preferences ~/.julia/dev/Preferences/src/Preferences.jl:285
[15] top-level scope
@ REPL[4]:1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.