Skip to content

Commit e0893bf

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/neo4j-java-support
# Conflicts: # README.md
2 parents b3b84d6 + 541ea2c commit e0893bf

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ analysis = CLDK.java(project_path="/path/to/java/project")
8181
for file_path, class_file in analysis.get_symbol_table().items():
8282
for type_name, type_declaration in class_file.type_declarations.items():
8383
for method in type_declaration.callable_declarations.values():
84-
body = analysis.get_method(type_name, method).code
85-
print(f"{type_name}.{method}\n{body}\n")
84+
body = analysis.get_method_body(method.declaration)
85+
print(f"{type_name}.{method.declaration}\n{body}\n")
8686
```
8787

8888
Build a call graph by raising the analysis level:
@@ -91,21 +91,20 @@ Build a call graph by raising the analysis level:
9191
from cldk import CLDK
9292
from cldk.analysis import AnalysisLevel
9393

94-
analysis = CLDK.java(
95-
project_path="/path/to/java/project",
94+
analysis = CLDK.python(
95+
project_path="/path/to/python/project",
9696
analysis_level=AnalysisLevel.call_graph,
9797
)
9898
call_graph = analysis.get_call_graph() # a networkx.DiGraph
9999
```
100100

101-
Select a backend by passing a typed config. For example, query a pre-populated graph **read-only**
102-
over Neo4j (no source or analyzer run needed) — available for all three languages:
101+
Select a backend by passing a typed config. For example, query a pre-populated graph **read-only** over Neo4j (no source or analyzer run needed):
103102

104103
```python
105104
from cldk import CLDK
106105
from cldk.analysis.commons.backend_config import Neo4jConnectionConfig
107106

108-
analysis = CLDK.java(
107+
analysis = CLDK.python(
109108
backend=Neo4jConnectionConfig(
110109
uri="bolt://localhost:7687",
111110
application_name="my-app", # the graph is populated out of band
@@ -128,6 +127,8 @@ Each language is analyzed by a dedicated `codeanalyzer-*` engine; CLDK normalize
128127

129128
The backend is selected by the **type** of the `backend=` config you pass to a factory: the in-process analyzer (default) or a `Neo4jConnectionConfig` for the read-only graph backend.
130129

130+
> **Analysis cache (Python):** caching is owned by `codeanalyzer-python` — the backend virtualenv, CodeQL database, and analysis cache live under `cache_dir` (default `<project>/.codeanalyzer`). CodeQL is on by default, so the first run is slow (it provisions a CodeQL DB) and later runs reuse a checksum-validated cache. Add the cache directory to your `.gitignore`.
131+
131132
## Architecture
132133

133134
The user interacts only with the top-level `CLDK` interface (`core.py`), which configures the session, initializes the language-specific pipeline, and exposes a high-level, language-agnostic API. Each language module is built from two pieces: **data models** and an **analysis backend**.
@@ -153,7 +154,7 @@ graph TD
153154

154155
**Data models** — each language has its own set of Pydantic models under `cldk.models` (`cldk.models.java`, `cldk.models.python`, `cldk.models.typescript`). They give you structured, typed, dot-accessible representations of classes, methods, fields, and statements, with JSON serialization and shared conventions across languages.
155156

156-
**Analysis backends** — each language has a backend under `cldk.analysis.<language>` that coordinates its engine (see the table above) and maps the result onto the data models. The read-only Neo4j backends (`cldk.analysis.<language>.neo4j`) reconstruct the *same* models from a Cypher graph, so they are drop-in interchangeable with the in-process analyzers. Backends are orchestrated internally; you only call high-level methods such as `get_symbol_table()`, `get_method(...)`, and `get_call_graph(...)`, and CLDK handles tool coordination, parsing, and marshalling under the hood.
157+
**Analysis backends** — each language has a backend under `cldk.analysis.<language>` that coordinates its engine (see the table above) and maps the result onto the data models. The read-only Neo4j backends (`cldk.analysis.<language>.neo4j`) reconstruct the *same* models from a Cypher graph, so they are drop-in interchangeable with the in-process analyzers. Backends are orchestrated internally; you only call high-level methods such as `get_symbol_table()`, `get_method_body(...)`, and `get_call_graph(...)`, and CLDK handles tool coordination, parsing, and marshalling under the hood.
157158

158159
## Documentation
159160

0 commit comments

Comments
 (0)