-
Notifications
You must be signed in to change notification settings - Fork 421
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
Make ChainRulesCore and DensityInterface weak dependencies #1686
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1686 +/- ##
=======================================
Coverage 85.81% 85.81%
=======================================
Files 131 137 +6
Lines 8310 8311 +1
=======================================
+ Hits 7131 7132 +1
Misses 1179 1179
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. |
This PR is ready for review. The logs (https://github.com/JuliaStats/Distributions.jl/actions/runs/4272559663/jobs/7482712943) show that on Julia >= 1.9 ChainRulesCore and DensityInterface are not installed automatically anymore but the extensions are precompiled and loaded successfully once they are (implicitly) loaded in the tests. |
@devmotion saw this a bit late, but isn't making DensityInterface a weak dependency rather a complication? It has a load time of 1.4 ms ... I had rather hoped to use more DensityInterface than less of it in the future. :-) |
It's easy to make it a proper dependency again, if needed. But currently it's "just" an additional interface that we support and hence a good fit for an extension, I think - even if it is only a minor contribution to load time. As soon as you load DensityInterface in your package/script, you have access to all methods but not every user might want to work with DensityInterface (similar to how not everyone needs ChainRules support or not every user of LogExpFunctions works with InverseFunctions). |
I agree, but since we we careful to make DensityInterface and InverseFunctions ultra-lightweight, what's the advantage of making them optional? I would guess that if both Distributions and DensityInterface are used then the extension package might even add another ms of load time. I agree that we should use the new Pkg extensions extensively, but I wonder if they useful for very lightweight deps intended to be community standards. |
This PR makes ChainRulesCore and DensityInterface weak dependencies on newer Julia versions that support extensions (see, e.g., https://pkgdocs.julialang.org/dev/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)).