1DOLLY 32MODULE python-pi-integration34# This layer is meaningful only when both Python/Bonnie and Pi are present.5REQUIRES TOOL bonnie6REQUIRES TOOL pi7REQUIRES TOOL python8REQUIRES TOOL slop9REQUIRES TOOL foreground10REQUIRES TOOL test11REQUIRES TOOL printf1213FILE /etc/dolly/init.slop14    if test -f "$HOME/.dollyrc"; then15      /bin/foreground /bin/slop -e "$HOME/.dollyrc"16      status=$?17      case "$status" in18        0|130) ;;19        *) printf 'Dolly: %s exited with status %s; continuing.\n' "$HOME/.dollyrc" "$status" >&2 ;;20      esac21    fi22    for attempt in 1 2 3; do23      /bin/foreground -i /usr/bin/pi24      status=$?25      case "$status" in 0|130) break ;; esac26      if test "$attempt" -lt 3; then27        printf '\nDolly: restarting Pi after unexpected status %s (%s/2).\n' "$status" "$attempt"28      fi29    done30    printf '\nDolly: image entry exited; entering the recovery Slop shell.\n'31    /bin/foreground -i /bin/slop3233FILE /home/dolly/.dollyrc34    printf '\033[33mDOLLY / PYTHON + PI\033[0m\n'35    printf 'Pi, CPython, Bonnie, and native extension builds all run inside Dolly.\n'36    printf 'Try: ! python --version | ! bonnie install requests | ask Pi to debug a package build\n'37    printf 'Source extension builds stream progress and can take several minutes.\n\n'38FILE /home/dolly/.pi/agent/skills/bonnie/SKILL.md39    ---40    name: bonnie41    description: Install and troubleshoot Python packages inside Dolly with the Bonnie package manager.42    ---43    44    # Bonnie45    46    Bonnie is Dolly's Python package manager. Use it instead of invoking `pip`47    directly: Bonnie keeps package metadata and artifact downloads on Dolly's one48    browser HTTP broker, then builds and installs entirely inside the Wasm sandbox.49    50    ## Normal workflow51    52    Inspect the environment first, then install the smallest explicit requirement:53    54    ```sh55    python --version56    bonnie install requests57    python -c 'import requests; print(requests.__version__)'58    ```59    60    Version constraints use ordinary Python requirement syntax:61    62    ```sh63    bonnie install 'package>=1.2,<2'64    ```65    66    Pure-Python wheels install quickly. If no compatible wheel exists, Bonnie67    selects the pinned source distribution and drives its PEP 517 build with the68    in-sandbox C/C++ compiler, Make, Ninja, and Meson compatibility surface. A69    large native build such as NumPy or Pandas can take several minutes. Do not70    mistake a long compile for a network hang; keep the command running while71    output is advancing, and use Ctrl+C when the user wants to cancel it.72    73    ## Troubleshooting74    75    - Run Bonnie through Slop, never Bash: `bonnie install PACKAGE`.76    - Preserve the first compiler error and the final Bonnie diagnostic when a77      build fails; later PEP 517 lines are often only summaries.78    - Verify an install with a small `python -c` import before changing sources.79    - Packages that require native sockets, host subprocesses, threads, or an80      unsupported system library may need a Dolly target configuration. Never add81      a Node, browser `fetch`, or native-host fallback.82    - Installed state belongs to the current in-memory session. Export or download83      user work that must survive closing the sandbox.84