Skip to content
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

Preferences and transitive dependencies #24

Closed
vchuravy opened this issue Dec 7, 2021 · 1 comment · Fixed by JuliaLang/julia#43361
Closed

Preferences and transitive dependencies #24

vchuravy opened this issue Dec 7, 2021 · 1 comment · Fixed by JuliaLang/julia#43361

Comments

@vchuravy
Copy link
Member

vchuravy commented Dec 7, 2021

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

@vchuravy
Copy link
Member Author

vchuravy commented Dec 7, 2021

From JuliaLang/julia#37791 (comment)

but the basic idea would be that if Flux attempts to set a preference in NNlib, today this would cause NNlib to get listed as an extra in the top-level Project.toml

vchuravy@odin ~/s/prefs> cat C/Project.toml 
name = "C"
uuid = "df71c7c7-715d-4a3c-a5e1-ea880813ce77"
authors = ["Valentin Churavy <[email protected]>"]
version = "0.1.0"

[deps]
B = "8913e2bf-78c8-4bed-b0db-99fb783f5b1d"

[extras]
A = "eadbc8b5-6f2c-475d-9756-0c67454fc69b"

vchuravy@odin ~/s/prefs> cat C/LocalPreferences.toml 
[A]
backend = "CUDA"

vchuravy@odin ~/s/prefs> julia --project=C -e "using B; @show B.active_backend()"
B.active_backend() = "OpenCL"

So it did indeed get listed in [extras].

vchuravy added a commit to JuliaLang/julia that referenced this issue Dec 7, 2021
When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24
vchuravy added a commit to JuliaLang/julia that referenced this issue Dec 7, 2021
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
KristofferC pushed a commit to JuliaLang/julia that referenced this issue Dec 9, 2021
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit 8197c41)
KristofferC pushed a commit to JuliaLang/julia that referenced this issue Dec 11, 2021
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit 8197c41)
KristofferC pushed a commit to JuliaLang/julia that referenced this issue Jan 10, 2022
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit 8197c41)
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Feb 22, 2022
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Mar 8, 2022
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
staticfloat pushed a commit to JuliaLang/julia that referenced this issue Dec 23, 2022
* Look for package name in `[extras]`

When Preferences.jl set's a preferences in a non-top-level package,
it adds that package to the `[extras]` entries in the project path.

Package loading should have used thhose entries to map the module uuid
to the key name in the Preferences.toml

Fixes JuliaPackaging/Preferences.jl#24

Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit 8197c41)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant