ph-code-graph 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/PKG-INFO +2 -2
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/pyproject.toml +2 -2
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/__init__.py +4 -4
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/_extract.py +7 -5
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/tests/test_code_graph.py +2 -2
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/.gitignore +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/LICENSE +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/README.md +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/_store.py +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/bundle.yaml +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/py.typed +0 -0
- {ph_code_graph-0.3.0 → ph_code_graph-0.5.0}/src/ph_code_graph/skills/code-graph/SKILL.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ph-code-graph
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: pH plugin: `code_index` and `code_graph`, a Python-native tree-sitter code graph with line-accurate answers.
|
|
5
5
|
Project-URL: Homepage, https://github.com/chastabor/pH
|
|
6
6
|
Project-URL: Repository, https://github.com/chastabor/pH
|
|
@@ -21,7 +21,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
21
21
|
Classifier: Topic :: Software Development
|
|
22
22
|
Classifier: Typing :: Typed
|
|
23
23
|
Requires-Python: >=3.12
|
|
24
|
-
Requires-Dist: ph-core==0.
|
|
24
|
+
Requires-Dist: ph-core==0.5.0
|
|
25
25
|
Requires-Dist: tree-sitter-language-pack>=1.16
|
|
26
26
|
Requires-Dist: tree-sitter>=0.25
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ph-code-graph"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.0"
|
|
8
8
|
description = "pH plugin: `code_index` and `code_graph`, a Python-native tree-sitter code graph with line-accurate answers."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -29,7 +29,7 @@ classifiers = [
|
|
|
29
29
|
# in (371 available, the rest fetched on demand — which this row never does
|
|
30
30
|
# implicitly; see `_extract.indexable`). No Rust toolchain, no Node, no
|
|
31
31
|
# submodule: the graph itself is stdlib `sqlite3`.
|
|
32
|
-
dependencies = ["ph-core==0.
|
|
32
|
+
dependencies = ["ph-core==0.5.0", "tree-sitter>=0.25", "tree-sitter-language-pack>=1.16"]
|
|
33
33
|
|
|
34
34
|
[project.urls]
|
|
35
35
|
Homepage = "https://github.com/chastabor/pH"
|
|
@@ -42,6 +42,7 @@ answers most of what an agent actually asks and reports where it cannot.
|
|
|
42
42
|
from __future__ import annotations
|
|
43
43
|
|
|
44
44
|
import hashlib
|
|
45
|
+
import importlib.util
|
|
45
46
|
import logging
|
|
46
47
|
from collections.abc import Mapping
|
|
47
48
|
from dataclasses import dataclass, field
|
|
@@ -198,7 +199,8 @@ class CodeGraphSeam:
|
|
|
198
199
|
|
|
199
200
|
def report(self) -> list[tuple[str, str]]:
|
|
200
201
|
"""`phern doctor`'s section."""
|
|
201
|
-
|
|
202
|
+
# Not a declared dependency: the row checks for it before this runs.
|
|
203
|
+
import tree_sitter # noqa: PLC0415
|
|
202
204
|
|
|
203
205
|
# No `hasattr` guard: the row declares `inject=[FS]`, so `ctx.fs` is
|
|
204
206
|
# present for as long as it is active — and a `Path.cwd()` fallback
|
|
@@ -491,11 +493,9 @@ def offer_skills(ctx: Context) -> None:
|
|
|
491
493
|
contribute_item(ctx, SKILLS, skill, label=f"skill({skill.name})")
|
|
492
494
|
|
|
493
495
|
|
|
494
|
-
@plugin("code-graph", inject=[TOOLS, FS], config=Config)
|
|
496
|
+
@plugin("code-graph", affects="environment", inject=[TOOLS, FS], config=Config)
|
|
495
497
|
async def apply(ctx: Context, config: Config) -> None:
|
|
496
498
|
"""Mount the seam and register both tools."""
|
|
497
|
-
import importlib.util
|
|
498
|
-
|
|
499
499
|
for module in ("tree_sitter", "tree_sitter_language_pack"):
|
|
500
500
|
if importlib.util.find_spec(module) is None:
|
|
501
501
|
raise MountRefusal(MISSING)
|
|
@@ -40,6 +40,7 @@ query alone yields two tags and no calls — measured. `INHERITS` is that fact.
|
|
|
40
40
|
from __future__ import annotations
|
|
41
41
|
|
|
42
42
|
import logging
|
|
43
|
+
import os
|
|
43
44
|
from collections.abc import Callable, Sequence
|
|
44
45
|
from dataclasses import dataclass, replace
|
|
45
46
|
from functools import cache
|
|
@@ -129,7 +130,8 @@ class Extraction:
|
|
|
129
130
|
|
|
130
131
|
|
|
131
132
|
def _pack() -> Any: # noqa: ANN401
|
|
132
|
-
|
|
133
|
+
# Not a declared dependency: the row checks for it before this runs.
|
|
134
|
+
import tree_sitter_language_pack # noqa: PLC0415
|
|
133
135
|
|
|
134
136
|
return tree_sitter_language_pack
|
|
135
137
|
|
|
@@ -196,8 +198,6 @@ def use_cache(directory: Path) -> Path:
|
|
|
196
198
|
An operator who set the environment variable deliberately keeps it — their
|
|
197
199
|
spelling wins, which is what makes the variable still mean something.
|
|
198
200
|
"""
|
|
199
|
-
import os
|
|
200
|
-
|
|
201
201
|
global _configured
|
|
202
202
|
|
|
203
203
|
override = os.environ.get("TREE_SITTER_LANGUAGE_PACK_CACHE_DIR")
|
|
@@ -343,7 +343,8 @@ def _tags_query(language: str) -> Any: # noqa: ANN401
|
|
|
343
343
|
for the same reason: a `Query` is read-only once built, and `extract` makes
|
|
344
344
|
a fresh `QueryCursor` per call — which is the mutable half.
|
|
345
345
|
"""
|
|
346
|
-
|
|
346
|
+
# Not a declared dependency: the row checks for it before this runs.
|
|
347
|
+
from tree_sitter import Query # noqa: PLC0415
|
|
347
348
|
|
|
348
349
|
pack = _pack()
|
|
349
350
|
sources = [pack.get_tags_query(one) for one in INHERITS.get(language, ())]
|
|
@@ -359,7 +360,8 @@ def extract(path: str, text: str, language: str) -> Extraction:
|
|
|
359
360
|
should stop the batch or be reported and skipped is its decision, not
|
|
360
361
|
this function's.
|
|
361
362
|
"""
|
|
362
|
-
|
|
363
|
+
# Not a declared dependency: the row checks for it before this runs.
|
|
364
|
+
from tree_sitter import QueryCursor # noqa: PLC0415
|
|
363
365
|
|
|
364
366
|
pack = _pack()
|
|
365
367
|
config = pack.ProcessConfig(
|
|
@@ -903,7 +903,7 @@ async def test_every_row_in_the_rlm_indexed_profile_activates(
|
|
|
903
903
|
the `PROFILES` entry and cannot test it — nothing there depends on the two
|
|
904
904
|
indexing distributions, which is the point of discovering them as bundles.
|
|
905
905
|
"""
|
|
906
|
-
from ph.cordis import Context, Profile, load_profile_documents
|
|
906
|
+
from ph.cordis import Context, Profile, ProfileDocument, load_profile_documents
|
|
907
907
|
from ph_app.profiles import resolve_profile
|
|
908
908
|
|
|
909
909
|
# `PH_HOME`/`PH_CACHE` are not pinned here: the suite's autouse
|
|
@@ -911,7 +911,7 @@ async def test_every_row_in_the_rlm_indexed_profile_activates(
|
|
|
911
911
|
# the first comes to be believed and bypassed.
|
|
912
912
|
documents = load_profile_documents(resolve_profile("rlm-indexed"))
|
|
913
913
|
documents.append(
|
|
914
|
-
(
|
|
914
|
+
ProfileDocument(
|
|
915
915
|
"test-overlay",
|
|
916
916
|
[
|
|
917
917
|
{"id": "fs", "config": {"root": str(tmp_path)}},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|