feedback_inbox: install kuhy_credit in the venv
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run

The CLI imports kuhy_credit since the logo commit, but install.sh put
only the package itself (--no-deps) in the venv, so every service run
died with ModuleNotFoundError and no game bundle became a task.
test_install.py checks one pip line per pyproject dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-21 19:48:10 +01:00
parent c439f54784
commit e2fb7535dd
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,34 @@
# Copyright (c) 2026 Krzysztof Rudnicki
"""install.sh puts every declared dependency into the venv.
The package itself is installed with --no-deps (no network at install time),
so each sibling package from pyproject's dependencies needs its own pip line.
A missing one made every service run die with ModuleNotFoundError
(kuhy_credit, 2026-11-21) and no bundle became a task.
"""
from __future__ import annotations
from pathlib import Path
import re
import tomllib
ROOT = Path(__file__).resolve().parents[2]
def _sibling_dirs() -> list[str]:
"""Return the utils subdirectory each declared dependency lives in."""
project = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]
dirs = []
for dep in project["dependencies"]:
match = re.search(r"subdirectory=([\w-]+)", dep)
assert match, f"dependency without a utils subdirectory: {dep}"
dirs.append(match.group(1))
return dirs
def test_install_installs_every_dependency() -> None:
script = (ROOT / "install.sh").read_text()
for sub in _sibling_dirs():
assert f'install --quiet --no-deps "$UTILS_DIR/{sub}"' in script, sub
assert (ROOT.parent / sub).is_dir(), sub

View File

@ -14,6 +14,7 @@ set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly REPO_DIR
readonly UTILS_DIR="${REPO_DIR%/*}"
readonly STATE_DIR="${HOME}/.local/share/feedback-inbox"
readonly VENV_DIR="${STATE_DIR}/venv"
readonly BIN_DIR="${HOME}/.local/bin"
@ -35,8 +36,12 @@ build_venv() {
mkdir -p "$STATE_DIR"
[[ -x "$VENV_DIR/bin/python" ]] || "$SYSTEM_PYTHON" -m venv "$VENV_DIR" \
|| fail "could not create the venv"
# One line per pyproject dependency (tests/test_install.py): the package
# itself goes in with --no-deps, so a missing line kills every run.
"$VENV_DIR/bin/pip" install --quiet --no-deps "$UTILS_DIR/kuhy_credit" \
|| fail "the kuhy_credit sibling package"
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" \
|| fail "feedback-inbox itself (stdlib only, no other packages)"
|| fail "feedback-inbox itself"
mkdir -p "$BIN_DIR"
ln -sf "$VENV_DIR/bin/feedback-inbox" "$BIN_DIR/feedback-inbox"
}