Skip to content

Drop the hard Pkg dependency; bump to v1.21.0 - #449

Open
thchr wants to merge 1 commit into
JuliaIO:masterfrom
thchr:drop-pkg-dep
Open

thchr wants to merge 1 commit into
JuliaIO:masterfrom
thchr:drop-pkg-dep

Conversation

@thchr

@thchr thchr commented Nov 6, 2026

Copy link
Copy Markdown

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 and Main. 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 an ArgumentError pointing to the :Name => uuid form. The one behavior change: a registered package that isn't installed used to register fine and fail only at load; 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 @stdlib in 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.

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

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.38%. Comparing base (6f9b1a1) to head (aa22aa5).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thchr

thchr commented Nov 10, 2026

Copy link
Copy Markdown
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

No deployments
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.

Drop the hard Pkg dependency

1 participant