Proposal: discover script content from pip packages, not just ~/MLC/repos git clones

オープン
#273 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
python
領域
tooling

調査の方向性

まず mlcflow#274 の Phase 1 プロトタイプと、pyproject.toml のパッケージ宣言を読んでください。次に、その discovery 動作を、ここで説明されている script/ ツリーおよび automation/ のスコープと比較してください。移行の判断、pip-first の優先順位、および MLC_SCRIPT_SOURCE_PRIORITY override について合意し、文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Proposal: discover script content from pip packages, not just ~/MLC/repos git clones

Today, script content (mlperf-automations's 377+ script/<alias>/ directories) only reaches mlcflow via mlc pull repo — a git clone into ~/MLC/repos/. This proposes a second, additive way to get content: pip-installed packages that self-advertise via a Python entry point, discovered generically (no hardcoded package names, forks included).

The approach

A content package (mlc-scripts, or a third-party fork) declares itself in its own pyproject.toml:

[project.entry-points."mlc.script_packages"]
mlperf-automations = "mlc_scripts_content"

mlcflow enumerates mlc.script_packages entry points on startup — a fast, local, no-network metadata read — and merges each into the same repo/index machinery git-cloned repos already use. Aliasing is by PyPI distribution name, not the self-chosen entry-point name, so a fork republished under a different distribution name coexists safely even if it reuses the same entry-point name.

What it looks like in practice

Installing is enough — no mlc pull repo step needed:

Install flow

And running a script doesn't care where it came from — git-cloned and pip-installed sources are interchangeable, including cross-source dependencies:

Script action flow

Source precedence: pip first, ~/MLC/repos as fallback, flippable by env var

The Phase 1 prototype (mlcflow#274) currently does the opposite of the intended default: pip-sourced repos are prepended to the repo list, but repos processed later win uid conflicts, so a git clone in ~/MLC/repos silently overrides a pip-installed package today. That was fine for a prototype proving the mechanism, but it's not the intended long-term default.

Proposed default: pip-installed packages are checked first for a given script; ~/MLC/repos git clones are only consulted as a fallback when no installed package provides that script. Rationale — a pip install/pip install --upgrade is pinned and reproducible; a git clone in ~/MLC/repos can drift silently (stale git pull, local edits) without the user noticing. Pip-first makes the more trustworthy, more explicit source win by default.

Escape hatch: an env var reverses the order for anyone who needs the old behavior (local script development against a git checkout, debugging, CI pinned to a specific commit) without recompiling or reinstalling anything:

export MLC_SCRIPT_SOURCE_PRIORITY=git   # default is "pip"

Source precedence flow

This is a per-script fallback, not "pick one source and ignore the other": if the priority source doesn't have a given script (or dependency), mlcflow still finds it in the other source. Cross-source dependency resolution (a git-cloned script depending on a pip-sourced one, or vice versa) is unaffected by which order they're checked in — it already works either way per the script-action-flow diagram above.

Scope of this issue

This tracks the longer-term decision: whether/when to migrate real script content (the full 377-script tree) to a properly packaged pip distribution, along with the source-precedence default and env-var override described above. Phase 1 (mlcflow#274) is a prototype proving the discovery mechanism only — it does not touch the real script tree or automation/, and does not yet implement the pip-first default or the env var; that's follow-up work once this proposal is agreed.

Full design detail (including the fork-disambiguation rationale and consequences to plan for — read-only pip-sourced repos, "latest" becoming an explicit pip install --upgrade, packaging prerequisites) is in the attached slide deck; happy to share the full deck if useful.

主要言語
Python
スター
14
フォーク
17
平均マージ
4日 3時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mlcommons/mlcflow のほかの issue

mlcommons/mlcflow の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。