setup-python-env

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Set Up Python Environment

设置 Python 环境

Bootstrap only. Direct packages this turn:
ruff
,
ipython
,
ipykernel
, and plain
skore
. Skore supplies
skore-skills
as a mandatory dependency. Other stage libraries go through
add-python-package
.
仅用于引导初始化。本轮直接安装的软件包:
ruff
、
ipython
、
ipykernel
和普通
skore
。Skore 会将
skore-skills
作为 必需依赖提供。其他阶段性库通过
add-python-package
添加。

Human-facing prose

面向用户的表述

Details:
setup-workspace
references/human_facing_prose.md
. Ask which manager to use and whether we manage the env in plain language. Do not name
G-ENV-MGR
, skill ids, or the wrapper CLI to the user. Do not mention
skore-skills
.
详情:
setup-workspace
references/human_facing_prose.md
。 用通俗语言询问使用哪个管理器,以及是否由我们管理该环境。 不要向用户提及
G-ENV-MGR
、skill ID 或 wrapper CLI。 不要提及
skore-skills
。

Lookup

查询

Run
env detect
and
status
first. Take the first row that matches, then run Sequence steps 3–6 only where the row says ask or continue. Do not stop after reading the table.
Caller
policy.env_manager
policy.env.managed
Manager questionManaged question
dispatchedset
true
or
false
skipskip
dispatchedset
null
skipask
dispatchedunset
true
or
false
ask when detect is
none
,
ambiguous
, or
mismatch
skip
dispatchedunset
null
ask when detect is
none
,
ambiguous
, or
mismatch
ask
standaloneanyanyask when detect is
none
,
ambiguous
, or
mismatch
ask
A standalone turn still asks when a manager is only recorded and nothing is on disk yet (
env_manager
is
"none"
). After the questions this row allows:
env.managed
false stops at step 5;
true
runs step 6 (
env init
,
env sync
,
env add-skore
with no
--mode
,
env verify
).
首先运行
env detect
和
status
。找到第一个匹配的行, 然后仅按该行中标注为“询问”或“继续”的情况执行“顺序” 部分的第 3–6 步。不要在读取表格后直接停止。
调用方
policy.env_manager
policy.env.managed
管理器选择问题环境托管问题
已调度已设置
true
或
false
跳过跳过
已调度已设置
null
跳过询问
已调度未设置
true
或
false
当 detect 为
none
、
ambiguous
或
mismatch
时询问
跳过
已调度未设置
null
当 detect 为
none
、
ambiguous
或
mismatch
时询问
询问
独立调用任意任意当 detect 为
none
、
ambiguous
或
mismatch
时询问
询问
即使仅记录了管理器且磁盘上尚无任何内容(
env_manager
为
"none"
),独立调用轮次仍需询问。完成该行允许的询问后:
env.managed
为 false 时在第 5 步停止;为 true 时执行第 6 步 (
env init
、
env sync
、不带
--mode
的
env add-skore
、
env verify
)。

Not this skill

不适用此 skill

A request to add a package outside
ruff
,
ipython
,
ipykernel
, and plain
skore
is not bootstrap. Do not
env init
and do not
pixi add
. Hand that package to the package-install step and stop. The close names the package and that step in plain language. Do not write the catalog id.
请求添加
ruff
、
ipython
、
ipykernel
和普通
skore
之外的 软件包不属于引导初始化。不要执行
env init
,也不要执行
pixi add
。将该软件包交给软件包安装步骤并停止。 结束回复时,用通俗语言说明该软件包和对应步骤。 不要写入目录 ID。

Sequence

顺序

  1. python -m skore_skills env detect
    and
    status
    .
  2. When
    setup-ml-project
    dispatched this turn, skip each question on its own.
    policy.env_manager
    set → do not ask which manager.
    policy.env.managed
    true
    or
    false
    → do not ask whether we manage the env. A recorded manager with
    env.managed
    still null still asks that one question. A recorded
    env.managed
    with no
    policy.env_manager
    does not reopen the managed question. A standalone request still asks, including when a manager is only recorded and nothing is on disk yet (
    env_manager
    is
    "none"
    ).
  3. G-ENV-MGR. Skip when step 2 skipped it. Otherwise read the JSON fields, not sentinel strings: ask when
    env_manager
    is
    "none"
    ,
    ambiguous
    is true, or
    mismatch
    is true. Use
    recommended
    as the ask order. PATH is not permission. Do not
    curl | sh
    .
  4. Skip when step 2 skipped it. Otherwise ask whether we manage the env (default yes). Persist
    python -m skore_skills policy set env.managed true
    or
    false
    .
  5. Unmanaged: stop. Name ruff / ipython / ipykernel / skore; do not init. Do not mention
    skore-skills
    to the user.
  6. Managed:
    policy set env_manager <manager>
    when it is not already recorded, then
    bash
    python -m skore_skills env init --manager <manager>
    python -m skore_skills env sync --execute
    python -m skore_skills env add-skore --execute
    python -m skore_skills env verify --execute
    Do not pass
    --mode
    . Omitting it installs for a recorded
    hub
    or
    mlflow
    destination, and plain Skore otherwise.
    If the selected manager is pixi and
    pixi.toml
    already exists, skip
    env init
    ; preserve that manifest and continue with
    env sync --execute
    . Never replace it or try to add
    [tool.pixi]
    to
    pyproject.toml
    .
    Do not hand-edit TOML. Do not run
    pixi init
    . Do not create
    src/
    . Do not ask where reports go. Plain Skore is the early install when no destination is recorded;
    add-python-package
    upgrades it for Hub or MLflow after that choice is recorded. Do not pass
    --mode local
    . If verify reports missing
    skore
    or
    skore_skills
    , rerun
    env add-skore --execute
    the same way; never add
    skore-skills
    directly. If verify reports missing agent tools, load
    add-python-package
    for ruff / ipython / ipykernel (agent feature) when that skill is installed, not a second
    env init
    . If
    add-python-package
    is not installed, name ruff / ipython / ipykernel and stop.
  1. 运行
    python -m skore_skills env detect
    和
    status
    。
  2. 当本轮由
    setup-ml-project
    调度时,逐个跳过已有答案的 询问。
    policy.env_manager
    已设置 → 不询问使用哪个管理器。
    policy.env.managed
    为
    true
    或
    false
    → 不询问是否由我们 管理环境。已记录管理器但
    env.managed
    仍为 null 时,仍需询问 该问题。已记录
    env.managed
    但没有
    policy.env_manager
    时, 不重新询问托管问题。独立调用请求仍需询问,包括仅记录了 管理器且磁盘上尚无任何内容的情况(
    env_manager
    为
    "none"
    )。
  3. G-ENV-MGR。 如果第 2 步已跳过本项,则跳过。否则读取 JSON 字段,而不是哨兵字符串:当
    env_manager
    为
    "none"
    、
    ambiguous
    为 true 或
    mismatch
    为 true 时询问。 使用
    recommended
    确定询问顺序。PATH 不是授权依据。 不要执行
    curl | sh
    。
  4. 如果第 2 步已跳过本项,则跳过。否则询问是否由我们管理 该环境(默认为“是”)。持久化
    python -m skore_skills policy set env.managed true
    或
    false
    。
  5. 未托管:停止。说明 ruff / ipython / ipykernel / skore; 不要初始化。不要向用户提及
    skore-skills
    。
  6. 托管:当尚未记录时执行
    policy set env_manager <manager>
    ,然后
    bash
    python -m skore_skills env init --manager <manager>
    python -m skore_skills env sync --execute
    python -m skore_skills env add-skore --execute
    python -m skore_skills env verify --execute
    不要传入
    --mode
    。省略该参数时,为已记录的
    hub
    或
    mlflow
    目标安装,否则安装普通 Skore。
    如果选择的管理器是 pixi 且
    pixi.toml
    已存在,则跳过
    env init
    ;保留该清单并继续执行
    env sync --execute
    。 绝不替换该清单,也不要尝试向
    pyproject.toml
    添加
    [tool.pixi]
    。
    不要手动编辑 TOML。不要运行
    pixi init
    。不要创建
    src/
    。 不要询问报告存放在哪里。未记录目标时,普通 Skore 是早期 安装项;记录该选择后,
    add-python-package
    会将其升级为 Hub 或 MLflow 版本。不要传入
    --mode local
    。 如果 verify 报告缺少
    skore
    或
    skore_skills
    ,以相同方式 重新运行
    env add-skore --execute
    ;绝不直接添加
    skore-skills
    。如果 verify 报告缺少 Agent 工具,则在
    add-python-package
    skill 已安装时加载它,以添加 ruff / ipython / ipykernel(Agent 功能),而不是第二次执行
    env init
    。如果
    add-python-package
    尚未安装,则说明 ruff / ipython / ipykernel 并停止。

Return and close

返回与结束

When dispatched by
setup-ml-project
, return to that caller after verification. Standalone, run
python -m skore_skills git end-turn --stage setup
. If JSON
action
is
invoke
, load
persist-ml-git
only if
status.skills.persist-ml-git
is true and stop; that skill returns to triage. If persist is missing, name the pending
staged
paths and stop. Otherwise load
triage-ml-task
only if
status.skills.triage-ml-task
is true; else stop.
当由
setup-ml-project
调度时,验证后返回该调用方。独立调用时, 运行
python -m skore_skills git end-turn --stage setup
。如果 JSON 的
action
为
invoke
,仅当
status.skills.persist-ml-git
为 true 时加载
persist-ml-git
并停止;该 skill 会返回分流环节。 如果缺少 persist,则列出待处理的
staged
路径并停止。否则,仅当
status.skills.triage-ml-task
为 true 时加载
triage-ml-task
; 否则停止。

Three environments

三种环境

Agent context only; do not narrate
skore-skills
to the user.
  • default — project runtime; bootstrap installs plain
    skore
    , which supplies
    skore-skills
    , when the report destination is unset or
    local
    . A recorded
    hub
    or
    mlflow
    destination uses that install instead.
  • agent — ruff, ipython, ipykernel.
  • dev — default + agent. Every later
    python -m skore_skills
    command uses this composed environment;
    env verify --execute
    must pass before other skills run.
仅用于 Agent 上下文;不要向用户叙述
skore-skills
。
  • default — 项目运行时;当报告目标未设置或为
    local
    时, 引导初始化会安装普通
    skore
    ,它会提供
    skore-skills
    。 如果已记录的目标为
    hub
    或
    mlflow
    ,则改为使用对应目标安装。
  • agent — ruff、ipython、ipykernel。
  • dev — default + agent。之后运行的每个
    python -m skore_skills
    命令都使用这个组合环境;在其他 skill 运行之前,
    env verify --execute
    必须通过。