Repository navigation
Conversation
Pkg was only used by the deprecated `add_loader`/`add_saver(fmt, ::Symbol)` methods, to resolve a package name to a UUID by scanning installed registries. That fallback is nearly unreachable in practice (the resulting PkgId must still be loadable via `Base.require`), yet it put Pkg into the dependency closure of every downstream package. Replace the registry scan with a lookup in `Base.loaded_modules` (covers a package registering itself from its own `__init__`), and otherwise throw an ArgumentError pointing to the `name => uuid` form. Pkg moves to the test extras, since test/integration.jl uses it. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #449 +/- ##
==========================================
+ Coverage 91.18% 92.38% +1.19%
==========================================
Files 11 11
Lines 715 709 -6
==========================================
+ Hits 652 655 +3
+ Misses 63 54 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
Bump. I think it would be good to do something here: FileIO has ~400 direct dependencies and ~1.000 indirect; all loading Pkg for no clear reason because of this. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the Pkg dependency, as suggested in #446, picking option B. I bumped to v1.21.0 and did not bump to v2, which would require a lot of downstream churn for very little benefit: the method that used Pkg has been deprecated since 2021, and its registry lookup only helped if a package was in the manifest but not a direct dependency.
The deprecated
add_loader/add_saver(fmt, ::Symbol)still resolve the name via the active environment andMain. On top of option B, they now also check already-loaded modules (Base.loaded_modules), which covers a package registering itself from its own__init__. If all of that fails, they throw anArgumentErrorpointing to the:Name => uuidform. The one behavior change: a registered package that isn't installed used to register fine and fail only atload; now it errors at registration.This cuts ~200 ms of load time from FileIO on my laptop, which seems worthwhile.
I didn't go for option A from #446: it loads Pkg without declaring it as a dependency, so it only works as long as Pkg can be found via
@stdlibin the load path. That bypasses the resolver (no compat bounds) and would break with a custom load path, or if Pkg ever ships as an upgradable stdlib.Closes #446.