Skip to content

Fix PyJulia on Julia 1.9 #523

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

Merged
merged 2 commits into from
Feb 27, 2023
Merged

Fix PyJulia on Julia 1.9 #523

merged 2 commits into from
Feb 27, 2023

Conversation

MilesCranmer
Copy link
Collaborator

This fixes #522 with the solution discussed in the thread. Julia 1.9 introduces a breaking change to how CLI flags are parsed: JuliaLang/julia#45335, so the install.jl script was parsing its arguments incorrectly. This fixes it and also adds 1.9 testing.

@MilesCranmer MilesCranmer requested a review from mkitti February 27, 2023 05:52
@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

What's the first argument then?

The alternative fix would be to change how install.jl is invoked, right?

@MilesCranmer
Copy link
Collaborator Author

The first argument is --. According to JuliaLang/julia#45335:

If -- appears after a non-option argument, it is preserved in ARGS. This -- has no effect on option processing since it's already stopped on the first non-option argument.

Although I'm not sure it completely works here (?) because the command is:

julia --startup-file=no --color=yes /Users/mcranmer/venvs/main/lib/python3.10/site-packages/julia-0.6.0-py3.10.egg/julia/install.jl -- install /Users/mcranmer/venvs/main/bin/python /opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/Python

yet -- gets parsed as the first element of ARGS. @KristofferC is this the intended behavior or maybe a bug?

@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Base: 87.23% // Head: 85.22% // Decreases project coverage by -2.01% ⚠️

Coverage data is based on head (2bff7c4) compared to base (1e3de7b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
- Coverage   87.23%   85.22%   -2.01%     
==========================================
  Files          39       39              
  Lines        2342     2342              
==========================================
- Hits         2043     1996      -47     
- Misses        299      346      +47     
Impacted Files Coverage Δ
src/julia/tools.py 75.55% <ø> (-2.23%) ⬇️
src/julia/runtests.py 31.48% <0.00%> (-40.75%) ⬇️
src/julia/utils.py 80.00% <0.00%> (-13.34%) ⬇️
src/julia/tests/utils.py 85.71% <0.00%> (-11.43%) ⬇️
src/julia/find_libpython.py 70.98% <0.00%> (-8.03%) ⬇️
src/julia/tests/test_find_libpython.py 94.44% <0.00%> (-5.56%) ⬇️
src/julia/libjulia.py 89.67% <0.00%> (-3.23%) ⬇️
src/julia/tests/test_sysimage.py 97.77% <0.00%> (-2.23%) ⬇️
src/julia/tests/test_compatible_exe.py 81.81% <0.00%> (-0.91%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

$ julia --help

    julia [switches] -- [programfile] [args...]

So the -- is in the wrong place. It should go before install.jl, not after it.

@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

It should be

julia --startup-file=no --color=yes -- /Users/mcranmer/venvs/main/lib/python3.10/site-packages/julia-0.6.0-py3.10.egg/julia/install.jl install /Users/mcranmer/venvs/main/bin/python /opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/Python

@MilesCranmer
Copy link
Collaborator Author

That makes sense. Will fix. Btw, how do I add CI testing for 1.9? Tried 1.9-nightly too but it didn't work.

@MilesCranmer
Copy link
Collaborator Author

Cool. Just confirmed locally that it fixes #522 completely.

@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

@MilesCranmer
Copy link
Collaborator Author

Great, that's it, thanks. So once that test passes, I'll remove those CI changes (because those version names are temporary), and we can just merge that argument ordering fix.

@MilesCranmer
Copy link
Collaborator Author

MilesCranmer commented Feb 27, 2023

I'm not sure what the 1.0 errors are though... Any idea? I should note that the latest PyCall.jl is only Julia 1.4+, so maybe 1.0 for PyJulia should be deprecated anyways.

@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

Hmm, I guess it did not work. I think 1.0 was aborted after the 1.9 did not work.

@MilesCranmer
Copy link
Collaborator Author

MilesCranmer commented Feb 27, 2023

Okay it looks like the only errors now are for Julia 1.0. So I propose we just raise that to 1.4, matching PyCall.jl, and then merge. (Note that automerge won't work, because I am removing the 1.0 CI tests)

@MilesCranmer
Copy link
Collaborator Author

MilesCranmer commented Feb 27, 2023

All tests passing, including Julia 1.4 through 1.9: https://github.com/JuliaPy/pyjulia/actions/runs/4280008230.

I'm now removing 1.9.0-beta4 tests until the stable version is released, so we can just merge the fix for now.

@mkitti mkitti enabled auto-merge (squash) February 27, 2023 09:46
@mkitti mkitti merged commit 28449f7 into JuliaPy:master Feb 27, 2023
@MilesCranmer MilesCranmer deleted the fix-julia-1.9 branch February 27, 2023 15:01
@MilesCranmer
Copy link
Collaborator Author

Awesome, thanks! How do we release versions here again? Do we just push a tag?

@mkitti
Copy link
Member

mkitti commented Feb 27, 2023

I think there is a Github action setup

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 this pull request may close these issues.

PyCall.jl setting incorrect libpython on Julia 1.9
2 participants