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

Abierto
#273 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
python
Área
tooling

Línea de trabajo

Empieza leyendo el prototipo de la Fase 1 en mlcflow#274 y la declaración del paquete en pyproject.toml. Después, compara su comportamiento de descubrimiento con el árbol script/ y el ámbito de automation/ descritos aquí. Se considera terminado cuando la decisión de migración, la precedencia pip-first y el override MLC_SCRIPT_SOURCE_PRIORITY estén acordados y documentados.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
14
Forks
17
Merge medio
4 d 3 h
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de mlcommons/mlcflow

Todos los issues de mlcommons/mlcflow

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.