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

Đang mở
#273 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu bằng cách đọc prototype Phase 1 trong mlcflow#274 và phần khai báo package trong pyproject.toml. Sau đó, so sánh hành vi discovery của nó với cây script/ và phạm vi automation/ được mô tả ở đây. Công việc được xem là hoàn tất khi quyết định migration, thứ tự ưu tiên pip-first và override MLC_SCRIPT_SOURCE_PRIORITY được thống nhất và ghi lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
14
Fork
17
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mlcommons/mlcflow

Tất cả issue của mlcommons/mlcflow

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.