Skip to content

hook install hardcodes python3, breaks in Nix/pipx environments #324

Closed

Description

@manjotsp

Problem

graphify hook install writes a post-commit hook that uses python3 as the interpreter:

python3 -c "
from graphify.watch import _rebuild_code
..."

In environments where graphify is installed via pipx but the default python3 is managed by Nix/direnv (or any other Python that doesn't have graphify in its site-packages), the hook fails:

ModuleNotFoundError: No module named 'graphify'

Expected behavior

The hook should resolve the correct Python interpreter — same logic the CLI binary already uses (pipx writes the correct shebang into the graphify script). Something like:

GRAPHIFY_PYTHON=$(head -1 "$(which graphify 2>/dev/null)" 2>/dev/null | tr -d '#!' || echo python3)
$GRAPHIFY_PYTHON -c "..."

Or embed the absolute path to the Python that was used when graphify hook install was run.

Workaround

Manually edit .git/hooks/post-commit to replace python3 with the pipx venv python path.

Environment

  • graphify installed via pipx install graphifyy
  • Default python3 managed by Nix devshell (no graphify in its site-packages)
  • macOS / Darwin

Activity

  1. safishamsi commented on Apr 14, 2026

    @safishamsi
    Member

    Fixed in v0.4.13.

    The AGENTS.md and GEMINI.md rebuild rule previously hardcoded python3 -c "from graphify.watch import _rebuild_code...", which breaks in Nix, pipx, venv, and any environment where python3 isn't the interpreter graphify was installed under.

    It now uses:

    graphify update .
    

    This resolves through the binary's shebang (so pipx, venv, and Nix all work correctly) and is also scoped to the project directory rather than the shell's CWD.

    pip install -U graphifyy

    Re-run graphify install after upgrading to get the updated AGENTS.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions