Drop the hard `Pkg` dependency
評価
調査の方向性
src/FileIO.jl の依存関係の宣言と using Pkg を読み、続いて src/deprecated.jl:50-67 の非推奨の呼び出し箇所と src/loadsave.jl:203 の現行のロードパスを調べてください。issue では2つの選択肢が提示されているため、まずメンテナーがどちらの方向を望んでいるのか確認してください。不要な依存関係を、サポート対象の非非推奨パスを壊さずに削除し、選択したオプションに従って非推奨の動作を処理できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
FileIO declares Pkg in [deps] and does using Pkg in src/FileIO.jl, but no non-deprecated code path uses it. Every Pkg.* call site (src/deprecated.jl:50-67) lives in the legacy add_loader/add_saver methods that are already marked # TODO: delete this method in FileIO v2. Since FileIO sits near the root of a large part of the ecosystem's dependency graph, every downstream package inherits Pkg into its closure and pays for it at using time.
The dependency dates to 0336017 (June 2019, the REQUIRE → Project.toml migration), when Pkg.installed() and Pkg.add were used to detect and install missing backends. Both uses are long gone; the live path loads backends with Base.require in src/loadsave.jl:203, which is pure Base.
The registry fallback is nearly unreachable
The remaining block resolves a package name to a UUID by scanning the installed registries, across three version-dependent branches. It only runs when Base.identify_package returns nothing — i.e. the package isn't a direct dep of the active project — but the PkgId it builds is then handed to Base.require, which needs the package in the load path anyway.
So it can only help when the package is an indirect dep: in the manifest, not a direct dep. Otherwise it either finds nothing or finds a UUID that fails at require later. That's a lot of machinery, plus a stdlib in every downstream closure, for a case callers can handle by passing name => uuid — which the non-deprecated API already asks for.
Option A — lazy load (non-breaking, 1.x)
Drop using Pkg and the [deps] entry; load on demand inside the deprecated method, which has already emitted a depwarn by that point:
const PKG_UUID = UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f")
_load_pkg() = Base.require(Base.PkgId(PKG_UUID, "Pkg"))
and access Pkg.API.Context() etc. through the returned module. Identical behaviour for anyone on the deprecated path; everyone else stops paying.
Option B — delete the lookup (v2)
Resolve via Base.identify_package and Main only, and when both fail throw something actionable:
throw(ArgumentError("could not resolve package \"$pkgname\" from the active environment; " *
"pass it as a Module or as `\"$pkgname\" => uuid`"))
- 主要言語
- Julia
- スター
- 228
- フォーク
- 83
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaIO/FileIO.jl のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
-
Add SVGZ formatオープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
JuliaIO/FileIO.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
question
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
brown-ccv/Chamber.jl#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JuliaAstro/SolarPosition.jl#143 ·
-
distributions
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JuliaBayes/Wren.jl#404 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JuliaAI/MLJTransforms.jl#113 ·
メンテナーはふだん 1 日以内に返信