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

feat: avoid adding packages that exist in the sysimage #2832

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/packages/Packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function sync_nbpkg_core(
new_packages = String.(external_package_names(new_topology)) # search all cells for imports and usings

removed = setdiff(old_packages, new_packages)
added = setdiff(new_packages, old_packages)
added = setdiff(new_packages, old_packages, PkgCompat.sysimage_module_names()) # Avoid adding the modules of the sysimage
can_skip = isempty(removed) && isempty(added) && notebook.nbpkg_ctx_instantiated

iolistener = let
Expand Down
8 changes: 8 additions & 0 deletions src/packages/PkgCompat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@ function project(ctx::PkgContext)
end
end

function sysimage_module_names()
@static if isdefined(Base, Symbol("_sysimage_modules"))
getproperty.(Base._sysimage_modules, :name)
else
String[]
end
end

# 🐸 "Public API", but using PkgContext
"Find a package in the manifest. Return `nothing` if not found."
_get_manifest_entry(ctx::PkgContext, package_name::AbstractString) =
Expand Down