pycode-kg 0.19.0__tar.gz → 0.19.1__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.
Files changed (61) hide show
  1. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/PKG-INFO +34 -17
  2. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/README.md +32 -15
  3. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/pyproject.toml +2 -2
  4. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/__init__.py +1 -1
  5. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/LICENSE +0 -0
  6. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/.DS_Store +0 -0
  7. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/__main__.py +0 -0
  8. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/analysis/__init__.py +0 -0
  9. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/analysis/bridge.py +0 -0
  10. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/analysis/centrality.py +0 -0
  11. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/analysis/framework_detector.py +0 -0
  12. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/analysis/hybrid_rank.py +0 -0
  13. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/app.py +0 -0
  14. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/architecture.py +0 -0
  15. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/build_pycodekg_lancedb.py +0 -0
  16. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/build_pycodekg_sqlite.py +0 -0
  17. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/__init__.py +0 -0
  18. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_analyze.py +0 -0
  19. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_architecture.py +0 -0
  20. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_bridges.py +0 -0
  21. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_build.py +0 -0
  22. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_build_full.py +0 -0
  23. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_centrality.py +0 -0
  24. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_explain.py +0 -0
  25. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_framework_nodes.py +0 -0
  26. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_hooks.py +0 -0
  27. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_init.py +0 -0
  28. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_mcp.py +0 -0
  29. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_model.py +0 -0
  30. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_query.py +0 -0
  31. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_snapshot.py +0 -0
  32. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/cmd_viz.py +0 -0
  33. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/main.py +0 -0
  34. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/cli/options.py +0 -0
  35. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/config.py +0 -0
  36. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/explain.py +0 -0
  37. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/graph.py +0 -0
  38. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/index.py +0 -0
  39. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/kg.py +0 -0
  40. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/layout3d.py +0 -0
  41. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/mcp_server.py +0 -0
  42. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/module/__init__.py +0 -0
  43. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/module/base.py +0 -0
  44. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/module/extractor.py +0 -0
  45. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/module/types.py +0 -0
  46. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg.py +0 -0
  47. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg_query.py +0 -0
  48. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg_snippet_packer.py +0 -0
  49. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg_thorough_analysis.py +0 -0
  50. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg_viz.py +0 -0
  51. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/pycodekg_viz3d.py +0 -0
  52. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/ranking/__init__.py +0 -0
  53. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/ranking/cli_rank.py +0 -0
  54. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/ranking/coderank.py +0 -0
  55. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/snapshots.py +0 -0
  56. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/sql/004_add_centrality_table.sql +0 -0
  57. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/store.py +0 -0
  58. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/utils.py +0 -0
  59. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/visitor.py +0 -0
  60. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/viz3d.py +0 -0
  61. {pycode_kg-0.19.0 → pycode_kg-0.19.1}/src/pycode_kg/viz3d_timeline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycode-kg
3
- Version: 0.19.0
3
+ Version: 0.19.1
4
4
  Summary: A tool to build a searchable knowledge graph from Python repositories
5
5
  License-Expression: Elastic-2.0
6
6
  License-File: LICENSE
@@ -66,7 +66,7 @@ Requires-Dist: streamlit (>=1.35.0) ; extra == "viz"
66
66
  Requires-Dist: torch (>=2.5.1)
67
67
  Requires-Dist: trame-vtk (>=2.0.0) ; extra == "all"
68
68
  Requires-Dist: trame-vtk (>=2.0.0) ; extra == "viz3d"
69
- Requires-Dist: transformers (>=4.57.6)
69
+ Requires-Dist: transformers (>=4.40.0,<4.57)
70
70
  Project-URL: Homepage, https://github.com/Flux-Frontiers/pycode_kg
71
71
  Project-URL: Repository, https://github.com/Flux-Frontiers/pycode_kg
72
72
  Description-Content-Type: text/markdown
@@ -78,7 +78,7 @@ Description-Content-Type: text/markdown
78
78
 
79
79
  [![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13-blue.svg)](https://www.python.org/)
80
80
  [![License: Elastic-2.0](https://img.shields.io/badge/License-Elastic%202.0-blue.svg)](https://www.elastic.co/licensing/elastic-license)
81
- [![Version](https://img.shields.io/badge/version-0.19.0-blue.svg)](https://github.com/Flux-Frontiers/pycode_kg/releases)
81
+ [![Version](https://img.shields.io/badge/version-0.19.1-blue.svg)](https://github.com/Flux-Frontiers/pycode_kg/releases)
82
82
  [![CI](https://github.com/Flux-Frontiers/pycode_kg/actions/workflows/ci.yml/badge.svg)](https://github.com/Flux-Frontiers/pycode_kg/actions/workflows/ci.yml)
83
83
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
84
84
  [![DOI](https://zenodo.org/badge/1202379010.svg)](https://zenodo.org/badge/latestdoi/1202379010)
@@ -117,23 +117,40 @@ PyCodeKG is designed to be useful at both ends — as a standalone command-line
117
117
 
118
118
  ### 1. Standalone — `pycodekg analyze`
119
119
 
120
- This is the bread and butter. One command, one repo, one architectural report:
120
+ This single command is the actual reason I wrote this module. I got tired of my LLM doing grep on my src/ in order to get a good analysis of the codebase. This command runs fifteen analysis passes in seconds and the output drops straight into your favorite coding LLM for targeted improvement suggestions. I used this process to iteratively improve PyCodeKG and several of the analysis passes were added as a result.
121
+
122
+ The analysis/ has files *_analysis_<date>.md - I ran PyCodeKG against **numpy** and **matplotlib** for fun.
121
123
 
122
124
  ```bash
125
+ pycodekg init # downloads embedder
123
126
  pycodekg build --repo . # one-time index
124
- pycodekg analyze . # the report
127
+ pycodekg analyze. # the full report
125
128
  ```
126
129
 
127
- `analyze` walks the graph and produces:
128
-
129
- - **Complexity hotspots** — high fan-in (broadly depended on, breaking-change risk) and high fan-out (orchestrators, refactoring candidates) functions, with risk levels
130
- - **Docstring coverage** broken down by module, class, function, method
131
- - **Circular import cycles** — module loops that cause hard-to-debug failures
132
- - **Orphaned functions** dead-code candidates with line counts (with caveats about entry points and reflection)
133
- - **Module coupling** — the import graph, with the most tightly coupled pairs called out
134
- - **Issues and strengths** high-level callouts suitable for a design review or release note
135
-
136
- It writes a Markdown report for humans and a timestamped JSON snapshot for tooling, CI gates, and trend tracking. Reach for `analyze` before any non-trivial refactor, at every release, and whenever you inherit an unfamiliar codebase. Full reference: [docs/Analyze.md](docs/Analyze.md).
130
+ **Note**
131
+ The first-time run can take some time to warm up. Be patient.
132
+
133
+ The 15-phase pipeline runs in sequence and surfaces several important metrics:
134
+
135
+ | # | Phase | What it surfaces |
136
+ |---|-------|-----------------|
137
+ | 1 | Baseline metrics | Node/edge counts, graph shape |
138
+ | 2 | CodeRank (global PageRank) | Structurally most important symbols |
139
+ | 3 | Fan-in analysis | Heavily depended-on functions (breaking-change risk) |
140
+ | 4 | Fan-out analysis | Orchestrators and complexity hotspots |
141
+ | 5 | Dependency analysis | Orphaned / dead code candidates |
142
+ | 6 | Pattern detection | Anti-patterns and structural red flags |
143
+ | 7 | Module coupling | Tightly coupled pairs, import graph density |
144
+ | 8 | Critical paths | Longest call chains, bottlenecks |
145
+ | 9 | Public API identification | Exposed vs. internal surface |
146
+ | 10 | Docstring coverage | By module, class, function, method |
147
+ | 11 | Inheritance hierarchy | Depth, multiple inheritance, diamond patterns |
148
+ | 12 | Insight synthesis | Issues + strengths callouts |
149
+ | 13 | Snapshot history | Metric trends across releases |
150
+ | 14 | Structural centrality (SIR) | Bridge nodes, graph removal impact |
151
+ | 15 | Concern-based ranking | Nodes grouped by architectural concern |
152
+
153
+ Every finding maps to a file and line number — no hallucinated signatures, no probabilistic guesses. The Markdown output is LLM-ready; the JSON snapshot is CI-gate-ready. Reach for `analyze` before any non-trivial refactor, at every release, and whenever you inherit an unfamiliar codebase. Full reference: [docs/Analyze.md](docs/Analyze.md).
137
154
 
138
155
  ```bash
139
156
  pycodekg analyze --quiet --json ~/.claude/pycodekg_analysis_latest.json
@@ -190,7 +207,7 @@ The graph is built around four node kinds (module, class, function, method) and
190
207
 
191
208
  ---
192
209
 
193
- ## What you can actually do with it
210
+ ## What you can do with it
194
211
 
195
212
  | If you want to… | Reach for | Detail |
196
213
  |---|---|---|
@@ -201,7 +218,7 @@ The graph is built around four node kinds (module, class, function, method) and
201
218
  | **Pull source-grounded context for an LLM** | `pycodekg pack "..." --format md` | [docs/CHEATSHEET.md](docs/CHEATSHEET.md) |
202
219
  | **Run a hybrid semantic + structural query** | `pycodekg query "..."` | [docs/CHEATSHEET.md](docs/CHEATSHEET.md) |
203
220
  | **Browse the graph interactively** | `pycodekg viz` (Streamlit) | [docs/INSTALLATION.md](docs/INSTALLATION.md) |
204
- | **See call graphs in 3-D** | `pycodekg viz3d --layout funnel` | [docs/VIZ3D.md](docs/VIZ3D.md) |
221
+ | **See call graphs in 3-D** *(active development — functional but rough)* | `pycodekg viz3d --layout funnel` | [docs/VIZ3D.md](docs/VIZ3D.md) |
205
222
  | **Wire it into Claude / Copilot / Cline** | `pycodekg mcp` | [docs/MCP.md](docs/MCP.md) |
206
223
 
207
224
  If you only read one doc after this one, read [docs/Analyze.md](docs/Analyze.md) — that's where most of the day-to-day value lives.
@@ -5,7 +5,7 @@
5
5
 
6
6
  [![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13-blue.svg)](https://www.python.org/)
7
7
  [![License: Elastic-2.0](https://img.shields.io/badge/License-Elastic%202.0-blue.svg)](https://www.elastic.co/licensing/elastic-license)
8
- [![Version](https://img.shields.io/badge/version-0.19.0-blue.svg)](https://github.com/Flux-Frontiers/pycode_kg/releases)
8
+ [![Version](https://img.shields.io/badge/version-0.19.1-blue.svg)](https://github.com/Flux-Frontiers/pycode_kg/releases)
9
9
  [![CI](https://github.com/Flux-Frontiers/pycode_kg/actions/workflows/ci.yml/badge.svg)](https://github.com/Flux-Frontiers/pycode_kg/actions/workflows/ci.yml)
10
10
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
11
11
  [![DOI](https://zenodo.org/badge/1202379010.svg)](https://zenodo.org/badge/latestdoi/1202379010)
@@ -44,23 +44,40 @@ PyCodeKG is designed to be useful at both ends — as a standalone command-line
44
44
 
45
45
  ### 1. Standalone — `pycodekg analyze`
46
46
 
47
- This is the bread and butter. One command, one repo, one architectural report:
47
+ This single command is the actual reason I wrote this module. I got tired of my LLM doing grep on my src/ in order to get a good analysis of the codebase. This command runs fifteen analysis passes in seconds and the output drops straight into your favorite coding LLM for targeted improvement suggestions. I used this process to iteratively improve PyCodeKG and several of the analysis passes were added as a result.
48
+
49
+ The analysis/ has files *_analysis_<date>.md - I ran PyCodeKG against **numpy** and **matplotlib** for fun.
48
50
 
49
51
  ```bash
52
+ pycodekg init # downloads embedder
50
53
  pycodekg build --repo . # one-time index
51
- pycodekg analyze . # the report
54
+ pycodekg analyze. # the full report
52
55
  ```
53
56
 
54
- `analyze` walks the graph and produces:
55
-
56
- - **Complexity hotspots** — high fan-in (broadly depended on, breaking-change risk) and high fan-out (orchestrators, refactoring candidates) functions, with risk levels
57
- - **Docstring coverage** broken down by module, class, function, method
58
- - **Circular import cycles** — module loops that cause hard-to-debug failures
59
- - **Orphaned functions** dead-code candidates with line counts (with caveats about entry points and reflection)
60
- - **Module coupling** — the import graph, with the most tightly coupled pairs called out
61
- - **Issues and strengths** high-level callouts suitable for a design review or release note
62
-
63
- It writes a Markdown report for humans and a timestamped JSON snapshot for tooling, CI gates, and trend tracking. Reach for `analyze` before any non-trivial refactor, at every release, and whenever you inherit an unfamiliar codebase. Full reference: [docs/Analyze.md](docs/Analyze.md).
57
+ **Note**
58
+ The first-time run can take some time to warm up. Be patient.
59
+
60
+ The 15-phase pipeline runs in sequence and surfaces several important metrics:
61
+
62
+ | # | Phase | What it surfaces |
63
+ |---|-------|-----------------|
64
+ | 1 | Baseline metrics | Node/edge counts, graph shape |
65
+ | 2 | CodeRank (global PageRank) | Structurally most important symbols |
66
+ | 3 | Fan-in analysis | Heavily depended-on functions (breaking-change risk) |
67
+ | 4 | Fan-out analysis | Orchestrators and complexity hotspots |
68
+ | 5 | Dependency analysis | Orphaned / dead code candidates |
69
+ | 6 | Pattern detection | Anti-patterns and structural red flags |
70
+ | 7 | Module coupling | Tightly coupled pairs, import graph density |
71
+ | 8 | Critical paths | Longest call chains, bottlenecks |
72
+ | 9 | Public API identification | Exposed vs. internal surface |
73
+ | 10 | Docstring coverage | By module, class, function, method |
74
+ | 11 | Inheritance hierarchy | Depth, multiple inheritance, diamond patterns |
75
+ | 12 | Insight synthesis | Issues + strengths callouts |
76
+ | 13 | Snapshot history | Metric trends across releases |
77
+ | 14 | Structural centrality (SIR) | Bridge nodes, graph removal impact |
78
+ | 15 | Concern-based ranking | Nodes grouped by architectural concern |
79
+
80
+ Every finding maps to a file and line number — no hallucinated signatures, no probabilistic guesses. The Markdown output is LLM-ready; the JSON snapshot is CI-gate-ready. Reach for `analyze` before any non-trivial refactor, at every release, and whenever you inherit an unfamiliar codebase. Full reference: [docs/Analyze.md](docs/Analyze.md).
64
81
 
65
82
  ```bash
66
83
  pycodekg analyze --quiet --json ~/.claude/pycodekg_analysis_latest.json
@@ -117,7 +134,7 @@ The graph is built around four node kinds (module, class, function, method) and
117
134
 
118
135
  ---
119
136
 
120
- ## What you can actually do with it
137
+ ## What you can do with it
121
138
 
122
139
  | If you want to… | Reach for | Detail |
123
140
  |---|---|---|
@@ -128,7 +145,7 @@ The graph is built around four node kinds (module, class, function, method) and
128
145
  | **Pull source-grounded context for an LLM** | `pycodekg pack "..." --format md` | [docs/CHEATSHEET.md](docs/CHEATSHEET.md) |
129
146
  | **Run a hybrid semantic + structural query** | `pycodekg query "..."` | [docs/CHEATSHEET.md](docs/CHEATSHEET.md) |
130
147
  | **Browse the graph interactively** | `pycodekg viz` (Streamlit) | [docs/INSTALLATION.md](docs/INSTALLATION.md) |
131
- | **See call graphs in 3-D** | `pycodekg viz3d --layout funnel` | [docs/VIZ3D.md](docs/VIZ3D.md) |
148
+ | **See call graphs in 3-D** *(active development — functional but rough)* | `pycodekg viz3d --layout funnel` | [docs/VIZ3D.md](docs/VIZ3D.md) |
132
149
  | **Wire it into Claude / Copilot / Cline** | `pycodekg mcp` | [docs/MCP.md](docs/MCP.md) |
133
150
 
134
151
  If you only read one doc after this one, read [docs/Analyze.md](docs/Analyze.md) — that's where most of the day-to-day value lives.
@@ -66,7 +66,7 @@ ruff = ">=0.4.0"
66
66
  # ---------------------------------------------------------------------------
67
67
  [project]
68
68
  name = "pycode-kg"
69
- version = "0.19.0"
69
+ version = "0.19.1"
70
70
  description = "A tool to build a searchable knowledge graph from Python repositories"
71
71
  readme = "README.md"
72
72
  license = "Elastic-2.0"
@@ -94,7 +94,7 @@ dependencies = [
94
94
  "safetensors>=0.5.0",
95
95
  "sentence-transformers>=5.4.1",
96
96
  "torch>=2.5.1",
97
- "transformers>=4.57.6",
97
+ "transformers>=4.40.0,<4.57",
98
98
  "kgmodule-utils>=0.2.1",
99
99
  ]
100
100
 
@@ -32,7 +32,7 @@ KGModule SDK (build new domain KGs)::
32
32
  from pycode_kg import KGModule, KGExtractor, PyCodeKGExtractor, NodeSpec, EdgeSpec
33
33
  """
34
34
 
35
- __version__ = "0.19.0"
35
+ __version__ = "0.19.1"
36
36
  __author__ = "Eric G. Suchanek, PhD"
37
37
 
38
38
  # Low-level primitives (locked v0 contract)
File without changes