Skip to content

Preferences and transitive dependencies #24

Closed
JuliaLang/julia
#43361
@vchuravy

Description

@vchuravy

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.

cc: @staticfloat @simonbyrne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions