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

lazily load Pkg #4955

Merged
merged 4 commits into from
Jul 5, 2024
Merged

Conversation

KristofferC
Copy link
Contributor

@KristofferC KristofferC commented Jul 3, 2024

This is a bit of a hack to work around the fact that depending on Pkg is quite expensive in 1.11. Here, we only load it when checking the compatibility / install status of a backend and also skipping that when the backend is GR.jl (since we know that is compatible due to resolving together with Plots).

I'll admit this is kind of ugly and a bit of "TTFP hacking". However, I don't think Plots.jl should depend on a package manager at all so 🤷.

TTFP change 2.1s to 1.7s

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 89.68%. Comparing base (fa65e7d) to head (c8d09df).
Report is 17 commits behind head on master.

Files Patch % Lines
src/backends.jl 70.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4955      +/-   ##
==========================================
- Coverage   89.77%   89.68%   -0.09%     
==========================================
  Files          40       40              
  Lines        8780     8801      +21     
==========================================
+ Hits         7882     7893      +11     
- Misses        898      908      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@isentropic
Copy link
Member

isentropic commented Jul 4, 2024

Not sure if we even need to depend on pkg given v2 and PlotsBase https://github.com/JuliaPlots/Plots.jl/tree/v2/PlotsBase

@KristofferC
Copy link
Contributor Author

KristofferC commented Jul 4, 2024

PlotsBase does the same:

get(Pkg.dependencies(), pkg_id.uuid, (; version = nothing)).version

But with extensions the compat should be enforced and maybe this code is not needed, or?

@isentropic
Copy link
Member

I dont think this function is needed at all now

function _check_installed(pkg::Union{Module,AbstractString,Symbol}; warn = true)

but lets wait for @BeastyBlacksmith to confirm

@BeastyBlacksmith
Copy link
Member

Thats true, that code can go in v2. However for the 1.x series we would need to up the julia compat, since pkgversion requires julia 1.9+

@KristofferC
Copy link
Contributor Author

since pkgversion requires julia 1.9+

It is easy to read the project file of the package and extract the version. I just didn't remember when pkgversion was introduced.

@BeastyBlacksmith BeastyBlacksmith merged commit c364ec8 into JuliaPlots:master Jul 5, 2024
11 of 16 checks passed
@KristofferC KristofferC deleted the kc/lazy_pkg branch July 5, 2024 11:40
@KristofferC
Copy link
Contributor Author

KristofferC commented Jul 5, 2024

(Looking forward to v2 which seems to have a great design avoiding these type of "hacks")

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.

3 participants