mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix: scope extras retry to [all] group only
_load_installable_optional_extras() was returning ALL extras from pyproject.toml except 'all', which included 'rl' and 'yc-bench' — extras not referenced by [all] that install heavy research deps (atroposlib, tinker, wandb) from git repos. Changed to parse the [all] group's references and only retry those 18 extras. Also moved tomllib import to function-level since it only runs during the rare fallback path.
This commit is contained in:
@@ -47,7 +47,6 @@ import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@@ -2912,8 +2911,15 @@ def _invalidate_update_cache():
|
||||
|
||||
|
||||
def _load_installable_optional_extras() -> list[str]:
|
||||
"""Return optional dependency groups except the aggregate ``all`` extra."""
|
||||
"""Return the optional extras referenced by the ``all`` group.
|
||||
|
||||
Only extras that ``[all]`` actually pulls in are retried individually.
|
||||
Extras outside ``[all]`` (e.g. ``rl``, ``yc-bench``) are intentionally
|
||||
excluded — they have heavy or platform-specific deps that most users
|
||||
never installed.
|
||||
"""
|
||||
try:
|
||||
import tomllib
|
||||
with (PROJECT_ROOT / "pyproject.toml").open("rb") as handle:
|
||||
project = tomllib.load(handle).get("project", {})
|
||||
except Exception:
|
||||
@@ -2923,7 +2929,17 @@ def _load_installable_optional_extras() -> list[str]:
|
||||
if not isinstance(optional_deps, dict):
|
||||
return []
|
||||
|
||||
return [name for name in optional_deps if name != "all"]
|
||||
# Parse the [all] group to find which extras it references.
|
||||
# Entries look like "hermes-agent[matrix]" or "package-name[extra]".
|
||||
all_refs = optional_deps.get("all", [])
|
||||
referenced: list[str] = []
|
||||
for ref in all_refs:
|
||||
if "[" in ref and "]" in ref:
|
||||
name = ref.split("[", 1)[1].split("]", 1)[0]
|
||||
if name in optional_deps:
|
||||
referenced.append(name)
|
||||
|
||||
return referenced
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user