-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another storing location #30
Comments
Preferences are stored on a per-project basis, so it's actually worse (or better) than you think: When you run In each of these projects, you can have different preferences applied. This is intentional, as although you may have I strongly suggest you embrace setting preferences on a per-project basis, however if you really want a global preference that is used for all Julia versions, you can add an environment to the end of Julia's load path in your startup.jl file, and provide "global defaults" that way: First, create your "global defaults" directory:
This results in a
We don't strictly speaking need Next, in your push!(Base.LOAD_PATH, expanduser("~/preferences_env/Project.toml")) Et voilà; you can now see that preference in whatever project you start Julia with:
|
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 ofv1.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")
whereset_prefs
is a function provided byFoo
package.Foo
knows thatfoo = "bar"
.using Foo
and I can see that instead offoo = "bar"
i getfoo = "default"
. And this is kind of unexpected, because my settings of packageFoo
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 withjulia --project=.
and] add Preferences
Foo
package was added in Julia environment with] dev Foo
julia --project=.
and usedusing Foo; Foo.set_username("foobar")
LocalPreferences.toml
appeared in~/.julia/environments/v1.7
The text was updated successfully, but these errors were encountered: