packs: ship python deps with the pack

A pack now owns the python deps its skills/bridge need, at
packs/<name>/requirements.txt (standard pip format). SkillPack.requirements_file
resolves it; the install plan lists the selected/enabled packs that ship one
(setup.build_plan / plan_from_config -> pack_requirements); bootstrap installs
each into .runtime/venv, so a host that never enables a pack installs nothing
for it.

Move the browser deps (Playwright) out of the agent repo's requirements/ into
packs/browser/requirements.txt; the Playwright binary download stays a
browser-specific bootstrap stage. --browser force-adds the pack's deps.

Docs (PACKGEN.md, AGENTS.md, README.md) describe the pattern; tests keep every
pack requirements.txt pinned and consistent with the manifest's requires.
This commit is contained in:
gabby committed 2026-10-14 18:05:56 +00:00
1 parent bf071ee529
commit b1a7bfd272
12 files changed
+180 -59

No files matched your search

+29
View File
@@ -32,6 +32,7 @@ from semif_agent.packs import (
PACKS = Path(__file__).resolve().parent.parent / "packs"
SKILL_DIRS = sorted(path.parent for path in PACKS.glob("*/skills/*/*/skill.py"))
BRIDGE_TESTS = sorted(PACKS.glob("*/bridge/test_*.py"))
PACK_REQUIREMENTS = sorted(PACKS.glob("*/requirements.txt"))
def seed_id(seed: Path) -> str:
@@ -88,6 +89,34 @@ def test_merge_packs_loads_enabled_and_skips_disabled():
assert tree["nextcloud"][0].category_description
@pytest.mark.parametrize(
"req_file",
PACK_REQUIREMENTS,
ids=[f"{p.parent.name}/{p.name}" for p in PACK_REQUIREMENTS],
)
def test_pack_requirements_are_pinned_and_consistent(req_file):
"""A pack owns its python deps: `packs/<name>/requirements.txt`.
Every line is pinned (a shipped integration installs exact versions) and the
manifest's human-readable `requires` summary stays consistent with the file.
"""
packs = {p.name: p for p in load_packs({"skill_packs": str(PACKS)})}
pack = packs[req_file.parent.name]
assert pack.requirements_file == req_file
lines = [
line.strip()
for line in req_file.read_text().splitlines()
if line.strip() and not line.strip().startswith("#")
]
assert lines, f"{req_file} declares no requirements"
for line in lines:
assert "==" in line, f"{req_file}: pin the version ({line!r})"
for dep in pack.requires:
assert any(dep.lower() in line.lower() for line in lines), (
f"{req_file}: manifest requires {dep!r} but requirements.txt omits it"
)
def test_manifestless_pack_root_is_one_implicit_pack(tmp_path):
directory = tmp_path / "my_skills" / "widgets" / "frobnicate"
directory.mkdir(parents=True)
+3
View File
@@ -88,6 +88,7 @@ def test_minimum_plan_installs_nothing_heavy():
assert plan["install_browser"] is False
assert plan["install_voice"] is False
assert plan["packs"] == ["essentials"]
assert plan["pack_requirements"] == []
# --------------------------------------------------------------------------- #
@@ -139,6 +140,8 @@ def test_maximum_config_enables_everything():
assert plan["install_voice"] is True
assert plan["install_bridge_service"] is True
assert plan["install_gateway_service"] is True
# The browser pack ships its own python deps; the plan names it for bootstrap.
assert plan["pack_requirements"] == ["browser"]
secrets = build_secrets(answers)
assert secrets["engine_winnow_api_key"] == "wk"