-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
--project=@script
does not activate script project if outside of the Project Directory
#55069
Comments
The root cause seems to be the use of Building julia with + /Users/alexwadell/Documents/julia_at_script_issue/julia/usr/bin/julia --project=@script --startup-file=no ./julia_at_script_issue/bin/test_at_script.jl
┌ Info: PROGRAM_FILE
│ PROGRAM_FILE =
└ @ Base Base.jl:625
┌ Info: init_load_path
└ @ Base initdefs.jl:245
┌ Info: load_path_expand
│ env = @script
└ @ Base initdefs.jl:278
┌ Info: load_path_expand - script - program file
│ PROGRAM_FILE =
└ @ Base initdefs.jl:288
┌ Info: load_path_expand - script
│ env = @script
│ dir =
└ @ Base initdefs.jl:299
┌ Info: load_path_expand - script - found
│ out = nothing
└ @ Base initdefs.jl:302
┌ Info: init_active_project
│ project = @script
│ load_path_expand(project) = nothing
└ @ Base initdefs.jl:265
┌ Info: load_path_expand
│ env = @script
└ @ Base initdefs.jl:278
┌ Info: load_path_expand - script - program file
│ PROGRAM_FILE =
└ @ Base initdefs.jl:288
┌ Info: load_path_expand - script
│ env = @script
│ dir =
└ @ Base initdefs.jl:299
┌ Info: load_path_expand - script - found
│ out = nothing
└ @ Base initdefs.jl:302
[...]
┌ Info: Check Active Env
│ Base.active_project() = "/Users/alexwadell/.julia/environments/v1.12/Project.toml"
│ PROGRAM_FILE = "./julia_at_script_issue/bin/test_at_script.jl"
│ Base.load_path_expand("@script") = "./julia_at_script_issue/Project.toml"
└ Base.current_project(dirname(PROGRAM_FILE)) = "./julia_at_script_issue/Project.toml"
[...] Doing Line 352 in d7609d8
Unfortunately, I think the fix is to add a |
This appears to still be present in the released version of 1.11, using the example in julia_at_script_issue.zip, I'm getting the following:
To summarize:
|
Yes, I can take a stab at it this weekend.
… On Oct 21, 2024, at 1:29 PM, Timothy ***@***.***> wrote:
Thanks for reporting and investigating this @awadell1 <https://github.com/awadell1>! Since you seem to have worked out what's going on here, would you be interested in spinning up a PR modifying JLOptions the way you describe?
cc: @Keno <https://github.com/Keno>, who originally introduced this functionality.
—
Reply to this email directly, view it on GitHub <#55069 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABMWAEXSUO6UTLYTE3S7JMDZ4U2YVAVCNFSM6AAAAABKQ5JTF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRXGMYTQMZQGA>.
You are receiving this because you were mentioned.
|
Tests for JuliaLang#55606 and JuliaLang#55069
As detailed in JuliaLang#55069, PROGRAM_FILE and ARGS are unset when `load_path_expand` is first called during `Base.__init__()`, this adds `program_file` to JLOptions as sets it during `jl_parse_opts` Removed `unsafe_load_commands` path in `load_path_expand` as ARGS is unset at this point.
Tests for JuliaLang#55606 and JuliaLang#55069
As detailed in JuliaLang#55069, PROGRAM_FILE and ARGS are unset when `load_path_expand` is first called during `Base.__init__()`, this adds `program_file` to JLOptions as sets it during `jl_parse_opts` Removed `unsafe_load_commands` path in `load_path_expand` as ARGS is unset at this point.
Tests for JuliaLang#55606 and JuliaLang#55069
As detailed in JuliaLang#55069, PROGRAM_FILE and ARGS are unset when `load_path_expand` is first called during `Base.__init__()`, this adds `program_file` to JLOptions as sets it during `jl_parse_opts` Removed `unsafe_load_commands` path in `load_path_expand` as ARGS is unset at this point.
Tests for JuliaLang#55606 and JuliaLang#55069
As detailed in JuliaLang#55069, PROGRAM_FILE and ARGS are unset when `load_path_expand` is first called during `Base.__init__()`, this adds `program_file` to JLOptions as sets it during `jl_parse_opts` Removed `unsafe_load_commands` path in `load_path_expand` as ARGS is unset at this point.
Launching a script with
julia --project=@script foo.jl
does not activate the script project if ran outside the containing folder.In
test_at_script.jL
Expected Directory Structure:
Running from
Documents/julia_at_script_issue/
withjulia --startup-file=no --project=@script bin/test_at_script.jl
or./bin/test_at_script.jl
gives the following (expected) output:However, running from outside of
Documents/julia_at_script_issue
activates the default environment instead:Oddly, enough
Base.load_path_expand("@cript")
resolves the correct project file.Setting
JULIA_LOAD_PATH
directly does result in the expect behavior outside the project directory:Julia Info
Related PRs
#50864
#53356
The text was updated successfully, but these errors were encountered: