-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add package extension for Makie #1494
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1494 +/- ##
=======================================
Coverage 95.40% 95.40%
=======================================
Files 360 360
Lines 29926 29925 -1
=======================================
Hits 28548 28548
+ Misses 1378 1377 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
For reference: We assume the fix for package extensions will be available in Julia v1.9.1 since it's included in the corresponding backports PR JuliaLang/julia#49680 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for initiating this!
Did you test this with
? |
Co-authored-by: Hendrik Ranocha <[email protected]>
With my original implementation, I tried Julia v1.9.0 and v1.10.0-DEV.1288. They both worked and showed the expected behavior. For v1.8, I thought to let CI sort it out whether it works or not |
If Requires is only used for this feature (I didn't check) it could also be conditionally loaded. |
No, it's still used for Plots.jl and some other stuff, but we'll eventually migrate everything. This is just to get our feet wet and to resolve the precompilation issue you mentioned in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you copy-pasted everything correctly - didn't check that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…Trixi.jl into msl/makie-pkg-extension
While true, I think a user is more happy to get an informative error message over
|
I completely agree. But how would you implement that without having to duplicate the function signature from the extension inside the main package? And adding a catchall |
@ranocha I added the |
I think it should be fine but we can never be sure as long as the Linux MPI tests keep failing. I created #1497 to mitigate this a bit. If you agree, we could first consider merging that PR to see whether everything is fine with coverage etc. here |
Sounds good! |
Coverage looks good. Thanks, @sloede |
This PR creates a package extension for the additional functionality we implemented that requires Makie.jl to be loaded. To remain backwards compatible with Julia v1.8, I've kept the current approach that is based on Requires.jl.
Package extensions were added in Julia v1.9. However, in the original implementation they are not triggered if the dependency is loaded from a different environment than the currently active one. This was remedied only in JuliaLang/julia#49701 (and will end up in Julia v1.9.1), thus I created the version guard such that the referenced PR is included.
When an appropriate, new Julia version is used, the package extension is loaded instead of relying on Requires.jl. The only user-visible difference is that we need to define and export the functions
iplot
andiplot!
already in Trixi.jl, since the package extension cannot export anything itself. This is somewhat against our usual policy and (and against POLA), since it means we have an exported function that has no usable implementation unless Makie.jl is loaded. @KristofferC suggested a potential remedy on Slack:However, for now I do not think this is necessary, as it creates new headaches (e.g., it splits the API definition between two places). Thus I suggest to do it this way for now and gather some real-world experience before using a more complicated implementation.