Skip to content

fix(pipeline): fall back to PATH lookup for cocoindex binary#261

Merged
HumanBean17 merged 3 commits into
masterfrom
fix/cocoindex-discovery-without-venv
Jun 6, 2026
Merged

fix(pipeline): fall back to PATH lookup for cocoindex binary#261
HumanBean17 merged 3 commits into
masterfrom
fix/cocoindex-discovery-without-venv

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

  • cocoindex_bin() used Path(sys.executable).parent / "cocoindex", which assumes a venv layout where cocoindex sits next to the Python interpreter
  • When installed via pip install --user, scripts land in ~/Library/Python/X.Y/bin/ while sys.executable points to the framework Python elsewhere (e.g. /Library/Frameworks/Python.framework/...), causing "cocoindex not found next to Python" errors
  • Adds shutil.which("cocoindex") as a fallback after the original sys.executable-relative check

Test plan

  • 620 passed, 9 skipped — existing test suite unchanged
  • Manual: pip install --user on macOS, confirm java-codebase-rag init finds cocoindex via PATH

🤖 Generated with Claude Code

When installed via `pip install --user`, scripts land in
~/Library/Python/X.Y/bin/ while sys.executable points to the framework
Python elsewhere. The new fallback uses shutil.which() to find cocoindex
on PATH when it's not next to the interpreter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@HumanBean17

Copy link
Copy Markdown
Owner Author

Review: fix(pipeline): fall back to PATH lookup for cocoindex binary

Clean, well-scoped fix. The fallback chain is sensible — venv-relative first (fast, no PATH search), then shutil.which, then return the original candidate so downstream errors still work.

One suggestion (non-blocking)

Both call sites that consume cocoindex_bin() check exe.is_file() and produce the error:

"cocoindex not found next to Python: {exe}"

After this change, the binary might come from PATH (e.g. ~/Library/Python/3.12/bin/cocoindex), so "next to Python" is misleading. Consider updating to just:

"cocoindex not found: {exe}"

at lines 120 and 182. Minor polish — safe to merge as-is.

HumanBean17 and others added 2 commits June 6, 2026 13:44
"next to Python" is misleading when the binary comes from PATH via
shutil.which(). Updated error and matching test assertion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit 4c7ae7b into master Jun 6, 2026
1 check passed
@HumanBean17 HumanBean17 deleted the fix/cocoindex-discovery-without-venv branch June 6, 2026 10:51
HumanBean17 added a commit that referenced this pull request Jun 6, 2026
…work, and deps cleanup

Restores tree to 2a3e4be (last pre-June-6) plus:
- 4c7ae7b fix(pipeline): fall back to PATH lookup for cocoindex binary (#261)
- 584db63 rework skill and agent to combine RAG graph navigation with file-system search (#269)
- f512e87 remove requirements.txt, declare all deps in pyproject.toml (#271)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
HumanBean17 added a commit that referenced this pull request Jun 6, 2026
…work, and deps cleanup (#274)

Restores tree to 2a3e4be (last pre-June-6) plus:
- 4c7ae7b fix(pipeline): fall back to PATH lookup for cocoindex binary (#261)
- 584db63 rework skill and agent to combine RAG graph navigation with file-system search (#269)
- f512e87 remove requirements.txt, declare all deps in pyproject.toml (#271)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant