fix: use correct Python interpreter for pipx installs
This commit is contained in:
+44
-33
@@ -58,15 +58,26 @@ Follow these steps in order. Do not skip steps.
|
|||||||
### Step 1 - Ensure graphify is installed
|
### Step 1 - Ensure graphify is installed
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "import graphify" 2>/dev/null || pip install graphifyy -q --break-system-packages 2>&1 | tail -3
|
# Detect the correct Python interpreter (handles pipx, venv, system installs)
|
||||||
|
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
|
||||||
|
if [ -n "$GRAPHIFY_BIN" ]; then
|
||||||
|
PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
|
||||||
|
else
|
||||||
|
PYTHON="python3"
|
||||||
|
fi
|
||||||
|
$PYTHON -c "import graphify" 2>/dev/null || pip install graphifyy -q --break-system-packages 2>&1 | tail -3
|
||||||
|
# Write interpreter path for all subsequent steps
|
||||||
|
$PYTHON -c "import sys; open('.graphify_python', 'w').write(sys.executable)"
|
||||||
```
|
```
|
||||||
|
|
||||||
If the import succeeds, print nothing and move straight to Step 2.
|
If the import succeeds, print nothing and move straight to Step 2.
|
||||||
|
|
||||||
|
**In every subsequent bash block, replace `python3` with `$(cat .graphify_python)` to use the correct interpreter.**
|
||||||
|
|
||||||
### Step 2 - Detect files
|
### Step 2 - Detect files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.detect import detect
|
from graphify.detect import detect
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -106,7 +117,7 @@ Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is determin
|
|||||||
For any code files detected, run AST extraction in parallel with Part B subagents:
|
For any code files detected, run AST extraction in parallel with Part B subagents:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.extract import collect_files, extract
|
from graphify.extract import collect_files, extract
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -144,7 +155,7 @@ Before dispatching subagents, print a timing estimate:
|
|||||||
Before dispatching any subagents, check which files already have cached extraction results:
|
Before dispatching any subagents, check which files already have cached extraction results:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.cache import check_semantic_cache
|
from graphify.cache import check_semantic_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -244,7 +255,7 @@ If more than half the chunks failed, stop and tell the user.
|
|||||||
|
|
||||||
Save new results to cache:
|
Save new results to cache:
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.cache import save_semantic_cache
|
from graphify.cache import save_semantic_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -257,7 +268,7 @@ print(f'Cached {saved} files')
|
|||||||
|
|
||||||
Merge cached + new results into `.graphify_semantic.json`:
|
Merge cached + new results into `.graphify_semantic.json`:
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -290,7 +301,7 @@ Clean up temp files: `rm -f .graphify_cached.json .graphify_uncached.txt .graphi
|
|||||||
#### Part C - Merge AST + semantic into final extraction
|
#### Part C - Merge AST + semantic into final extraction
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -325,7 +336,7 @@ print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(s
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p graphify-out
|
mkdir -p graphify-out
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.cluster import cluster, score_all
|
from graphify.cluster import cluster, score_all
|
||||||
@@ -378,7 +389,7 @@ Read `.graphify_analysis.json`. For each community key, look at its node labels
|
|||||||
Then regenerate the report and save the labels for the visualizer:
|
Then regenerate the report and save the labels for the visualizer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.cluster import score_all
|
from graphify.cluster import score_all
|
||||||
@@ -418,7 +429,7 @@ Replace INPUT_PATH with the actual path.
|
|||||||
If `--obsidian` was given:
|
If `--obsidian` was given:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_obsidian, to_canvas
|
from graphify.export import to_obsidian, to_canvas
|
||||||
@@ -449,7 +460,7 @@ print(' _COMMUNITY_* - overview notes with cohesion scores and dataview queries
|
|||||||
Generate the HTML graph (always, unless `--no-viz`):
|
Generate the HTML graph (always, unless `--no-viz`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_html
|
from graphify.export import to_html
|
||||||
@@ -476,7 +487,7 @@ else:
|
|||||||
**If `--neo4j`** - generate a Cypher file for manual import:
|
**If `--neo4j`** - generate a Cypher file for manual import:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_cypher
|
from graphify.export import to_cypher
|
||||||
@@ -491,7 +502,7 @@ print('cypher.txt written - import with: cypher-shell < graphify-out/cypher.txt'
|
|||||||
**If `--neo4j-push <uri>`** - push directly to a running Neo4j instance. Ask the user for credentials if not provided:
|
**If `--neo4j-push <uri>`** - push directly to a running Neo4j instance. Ask the user for credentials if not provided:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.cluster import cluster
|
from graphify.cluster import cluster
|
||||||
@@ -513,7 +524,7 @@ Replace `NEO4J_URI`, `NEO4J_USER`, `NEO4J_PASSWORD` with actual values. Default
|
|||||||
### Step 7b - SVG export (only if --svg flag)
|
### Step 7b - SVG export (only if --svg flag)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_svg
|
from graphify.export import to_svg
|
||||||
@@ -535,7 +546,7 @@ print('graph.svg written - embeds in Obsidian, Notion, GitHub READMEs')
|
|||||||
### Step 7c - GraphML export (only if --graphml flag)
|
### Step 7c - GraphML export (only if --graphml flag)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_graphml
|
from graphify.export import to_graphml
|
||||||
@@ -577,7 +588,7 @@ To configure in Claude Desktop, add to `claude_desktop_config.json`:
|
|||||||
If `total_words` from `.graphify_detect.json` is greater than 5,000, run:
|
If `total_words` from `.graphify_detect.json` is greater than 5,000, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.benchmark import run_benchmark, print_benchmark
|
from graphify.benchmark import run_benchmark, print_benchmark
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -595,7 +606,7 @@ Print the output directly in chat. If `total_words <= 5000`, skip silently - the
|
|||||||
### Step 9 - Save manifest, update cost tracker, clean up, and report
|
### Step 9 - Save manifest, update cost tracker, clean up, and report
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
@@ -629,7 +640,7 @@ cost_path.write_text(json.dumps(cost, indent=2))
|
|||||||
print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
|
print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
|
||||||
print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
|
print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
|
||||||
"
|
"
|
||||||
rm -f .graphify_detect.json .graphify_extract.json .graphify_ast.json .graphify_semantic.json .graphify_analysis.json .graphify_labels.json
|
rm -f .graphify_detect.json .graphify_extract.json .graphify_ast.json .graphify_semantic.json .graphify_analysis.json .graphify_labels.json .graphify_python
|
||||||
rm -f graphify-out/.needs_update 2>/dev/null || true
|
rm -f graphify-out/.needs_update 2>/dev/null || true
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -667,7 +678,7 @@ The graph is the map. Your job after the pipeline is to be the guide.
|
|||||||
Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
|
Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.detect import detect_incremental, save_manifest
|
from graphify.detect import detect_incremental, save_manifest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -686,7 +697,7 @@ print(f'{new_total} new/changed file(s) to re-extract.')
|
|||||||
If new files exist, first check whether all changed files are code files:
|
If new files exist, first check whether all changed files are code files:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -706,7 +717,7 @@ If `code_only` is False (any changed file is a doc/paper/image): run the full St
|
|||||||
Then:
|
Then:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
from graphify.export import to_json
|
from graphify.export import to_json
|
||||||
@@ -733,7 +744,7 @@ Then run Steps 4–8 on the merged graph as normal.
|
|||||||
After Step 4, show the graph diff:
|
After Step 4, show the graph diff:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json
|
import json
|
||||||
from graphify.analyze import graph_diff
|
from graphify.analyze import graph_diff
|
||||||
from graphify.build import build_from_json
|
from graphify.build import build_from_json
|
||||||
@@ -767,7 +778,7 @@ Clean up after: `rm -f .graphify_old.json`
|
|||||||
Skip Steps 1–3. Load the existing graph from `graphify-out/graph.json` and re-run clustering:
|
Skip Steps 1–3. Load the existing graph from `graphify-out/graph.json` and re-run clustering:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from graphify.cluster import cluster, score_all
|
from graphify.cluster import cluster, score_all
|
||||||
from graphify.analyze import god_nodes, surprising_connections
|
from graphify.analyze import god_nodes, surprising_connections
|
||||||
@@ -820,7 +831,7 @@ Two traversal modes - choose based on the question:
|
|||||||
|
|
||||||
First check the graph exists:
|
First check the graph exists:
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
if not Path('graphify-out/graph.json').exists():
|
if not Path('graphify-out/graph.json').exists():
|
||||||
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
||||||
@@ -838,7 +849,7 @@ Load `graphify-out/graph.json`, then:
|
|||||||
5. If the graph lacks enough information, say so - do not hallucinate edges.
|
5. If the graph lacks enough information, say so - do not hallucinate edges.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys, json
|
import sys, json
|
||||||
from networkx.readwrite import json_graph
|
from networkx.readwrite import json_graph
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
@@ -929,7 +940,7 @@ Replace `QUESTION` with the user's actual question, `MODE` with `bfs` or `dfs`,
|
|||||||
After writing the answer, save it back into the graph so it improves future queries:
|
After writing the answer, save it back into the graph so it improves future queries:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from graphify.ingest import save_query_result
|
from graphify.ingest import save_query_result
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
save_query_result(
|
save_query_result(
|
||||||
@@ -953,7 +964,7 @@ Find the shortest path between two named concepts in the graph.
|
|||||||
|
|
||||||
First check the graph exists:
|
First check the graph exists:
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
if not Path('graphify-out/graph.json').exists():
|
if not Path('graphify-out/graph.json').exists():
|
||||||
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
||||||
@@ -963,7 +974,7 @@ if not Path('graphify-out/graph.json').exists():
|
|||||||
If it fails, stop and tell the user to run `/graphify <path>` first.
|
If it fails, stop and tell the user to run `/graphify <path>` first.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json, sys
|
import json, sys
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
from networkx.readwrite import json_graph
|
from networkx.readwrite import json_graph
|
||||||
@@ -1015,7 +1026,7 @@ Replace `NODE_A` and `NODE_B` with the actual concept names from the user. Then
|
|||||||
After writing the explanation, save it back:
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from graphify.ingest import save_query_result
|
from graphify.ingest import save_query_result
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
save_query_result(
|
save_query_result(
|
||||||
@@ -1037,7 +1048,7 @@ Give a plain-language explanation of a single node - everything connected to it.
|
|||||||
|
|
||||||
First check the graph exists:
|
First check the graph exists:
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
if not Path('graphify-out/graph.json').exists():
|
if not Path('graphify-out/graph.json').exists():
|
||||||
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
||||||
@@ -1047,7 +1058,7 @@ if not Path('graphify-out/graph.json').exists():
|
|||||||
If it fails, stop and tell the user to run `/graphify <path>` first.
|
If it fails, stop and tell the user to run `/graphify <path>` first.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import json, sys
|
import json, sys
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
from networkx.readwrite import json_graph
|
from networkx.readwrite import json_graph
|
||||||
@@ -1092,7 +1103,7 @@ Replace `NODE_NAME` with the concept the user asked about. Then write a 3-5 sent
|
|||||||
After writing the explanation, save it back:
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
from graphify.ingest import save_query_result
|
from graphify.ingest import save_query_result
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
save_query_result(
|
save_query_result(
|
||||||
@@ -1113,7 +1124,7 @@ print('Explanation saved to graphify-out/memory/')
|
|||||||
Fetch a URL and add it to the corpus, then update the graph.
|
Fetch a URL and add it to the corpus, then update the graph.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -c "
|
$(cat .graphify_python) -c "
|
||||||
import sys
|
import sys
|
||||||
from graphify.ingest import ingest
|
from graphify.ingest import ingest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "graphifyy"
|
name = "graphifyy"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
description = "Claude Code skill - turn any folder of code, docs, papers, images, or tweets into a queryable knowledge graph"
|
description = "Claude Code skill - turn any folder of code, docs, papers, images, or tweets into a queryable knowledge graph"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|||||||
Reference in New Issue
Block a user