Skip to content

fix: improve uv run tab completion for #520 - #521

Merged
TATP-233 merged 2 commits into
mainfrom
fxl_tab_complete
May 28, 2026
Merged

TATP-233 merged 2 commits into
mainfrom
fxl_tab_complete

Conversation

@DH13768095744

Copy link
Copy Markdown
Contributor

摘要

  • 修复 uv run eval --load-run <TAB> 的误导补全:现在返回已支持的 latest-run 别名 -1,并在已有 --algo / --task / --sim 上下文时补全当前任务日志目录下的真实 run 目录名,不再返回无关 flags。
  • 为 train/eval --profile <TAB> 增加值补全:从已有 task owner metadata 中派生 profile 名称。
  • 改善 bash/zsh completion 在源码 checkout 下的 fallback:从被 source 的 completion 脚本路径解析 repo root,并通过 PYTHONPATH=<repo>/src 调用 Python module。
  • 移除 unilab.__init__ 中不必要的 etils 依赖,使轻量 completion import 可以在完整运行时依赖不可用时工作。
  • 增加 completion 测试,覆盖 --load-run 的 -1 和真实 run 目录候选、profile 候选过滤、前缀匹配、training.log_root、profile 覆盖 algo_log_name,以及选中 profile 后的 task 过滤。

用户可见行为变化:

  • eval --load-run <TAB> 现在提示 -1 和匹配的真实 run 目录名,不再提示无效 flags。
  • train/eval --profile <TAB> 在存在 profile owner YAML 时会提示匹配的 profile 名称。
  • 在 console script 尚不可用的源码 checkout 中,completion fallback 更稳健。

训练影响:

  • 预期不影响训练行为。
  • 预期不影响后端运行时行为。

验证

  • make check
  • uv run --active --no-sync pytest -m "not slow"
  • python -m pytest
  • 下方列出的任务专项验证

验证结果说明:

  • PYTHONPATH=src uv run --no-sync python -m unilab.tools.completion --cword 2 -- uv run "" 返回了预期的一层候选:train、eval、demo、unilab-complete、unilab-export-scene、unilab-viz-nan、benchmark/、scripts/。
  • source scripts/completions/unilab.bash 后直接调用 _unilab_uv_complete,返回了同样的一层候选。
  • zsh -n scripts/completions/unilab.zsh 通过。
  • uv sync --active --extra motrix 完成依赖同步。
  • uv run --active --no-sync pytest tests/test_completion.py -q 通过:9 passed in 0.07s。
  • uv run --active --no-sync pytest -m "not slow" 通过:1006 passed, 15 skipped, 254 deselected, 62 warnings in 68.80s。
  • uv pip install --python "$CONDA_PREFIX/bin/python" -e ".[motrix]" --group dev 已将 UniLab 运行和开发依赖安装到 conda activate unilab 对应的 Python 环境中。
  • python -m pytest tests/test_completion.py -q 通过:9 passed in 0.07s。
  • python -m pytest 通过。由于仓库 pyproject.toml 默认 addopts = "--tb=short -m 'not slow'",实际执行的是非 slow 集合:1006 passed, 15 skipped, 254 deselected, 62 warnings in 39.54s。

影响

  • 后端影响:none
  • 平台影响:both
  • 预期训练影响:no

@DH13768095744
DH13768095744 requested a review from TATP-233 as a code owner May 28, 2026 14:40
@TATP-233
TATP-233 merged commit 45a86f7 into main May 28, 2026
7 checks passed
@TATP-233
TATP-233 deleted the fxl_tab_complete branch May 28, 2026 14:46
TATP-233 added a commit that referenced this pull request May 30, 2026
fix: improve uv run tab completion for #520
TATP-233 added a commit that referenced this pull request May 30, 2026
fix: improve uv run tab completion for #520
TATP-233 added a commit that referenced this pull request Sep 4, 2026
fix: improve uv run tab completion for #520
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.

2 participants