Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions src/content/docs/reference/python-api/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ The full generated reference follows.

<!-- AUTO-GENERATED by scripts/gen_api_docs.py, do not edit by hand. -->

[![Source on GitHub](https://img.shields.io/badge/source-codellm--devkit%2Fpython--sdk-181717?logo=github&logoColor=white)](https://github.com/codellm-devkit/python-sdk) [![cldk 1.4.0](https://img.shields.io/badge/cldk-1.4.0-3776AB?logo=pypi&logoColor=white)](https://pypi.org/project/cldk/1.4.0/)
[![Source on GitHub](https://img.shields.io/badge/source-codellm--devkit%2Fpython--sdk-181717?logo=github&logoColor=white)](https://github.com/codellm-devkit/python-sdk) [![cldk 2.0.0rc3](https://img.shields.io/badge/cldk-2.0.0rc3-3776AB?logo=pypi&logoColor=white)](https://pypi.org/project/cldk/2.0.0rc3/)

_API reference generated from cldk 1.4.0._
_API reference generated from cldk 2.0.0rc3._

Core CLDK module.

Expand All @@ -157,16 +157,14 @@ parsers, and sanitization utilities.
> tables, call graphs, and code metrics.
> - **Python**: Static analysis via codeanalyzer-python backend (Jedi plus
> PyCG call-graph construction).
> - **C**: Basic analysis via libclang for parsing and extracting code structure.

Typical usage involves instantiating `CLDK` with a target language, then
calling `analysis` to obtain a language-specific analysis facade.

> **Note**
> This module requires language-specific backends to be available:
> - Java: ``codeanalyzer-*.jar`` (auto-downloaded or specified via path)
> - Java: ``codeanalyzer-java`` (the ``cldk[java]`` extra; carries the jar and its JVM)
> - Python: ``codeanalyzer-python`` (auto-installed in virtualenv)
> - C: ``libclang`` (must be installed on the system)

## `CLDK`

Expand All @@ -190,7 +188,7 @@ methods.

| Name | Type | Description |
| ---- | ---- | ----------- |
| `language` | `str` | The target programming language for analysis. Supported values are ``"java"``, ``"python"``, and ``"c"`` (case-sensitive). |
| `language` | `str` | The target programming language for analysis. Supported values are ``"java"``, ``"python"``, and ``"typescript"`` (case-sensitive). |

**Raises:**

Expand All @@ -199,7 +197,6 @@ methods.
> **See Also**
> - `JavaAnalysis`: Java-specific analysis facade.
> - `PythonAnalysis`: Python-specific analysis facade.
> - `CAnalysis`: C-specific analysis facade.

### Attributes

Expand All @@ -212,7 +209,7 @@ methods.
#### `CLDK.java`

```python
java(project_path: str | Path | None = None, source_code: str | None = None, analysis_level: str = AnalysisLevel.symbol_table, target_files: List[str] | None = None, eager: bool = False, backend: JavaBackend | None = None) -> JavaAnalysis
java(project_path: str | Path | None = None, analysis_level: str = AnalysisLevel.symbol_table, target_files: List[str] | None = None, eager: bool = False, backend: JavaBackend | None = None) -> JavaAnalysis
```

Create a Java analysis facade.
Expand All @@ -222,15 +219,14 @@ Create a Java analysis facade.
| Name | Type | Description |
| ---- | ---- | ----------- |
| `project_path` | `str \| Path \| None` | Path to the Java project directory. Optional only when ``backend`` is a `Neo4jConnectionConfig` (the graph is read out of band over Bolt). When provided, the path is validated, it must exist and be a directory, regardless of backend. |
| `source_code` | `str \| None` | Single Java source string (deprecated; pass ``project_path`` instead). |
| `analysis_level` | `str` | Analysis depth (see `AnalysisLevel`). |
| `target_files` | `List[str] \| None` | Restrict analysis to these files. |
| `eager` | `bool` | Force regeneration of cached analysis. |
| `backend` | `JavaBackend \| None` | Backend configuration. Defaults to `CodeAnalyzerConfig`. |
| `backend` | `JavaBackend \| None` | Backend configuration. Defaults to `CodeAnalyzerConfig`; pass a `Neo4jConnectionConfig` to use the read-only Neo4j backend. |

**Raises:**

- `CldkInitializationException`: If neither or both of ``project_path`` / ``source_code`` are provided.
- `CldkInitializationException`: If ``project_path`` is missing and the backend is not Neo4j. (The 1.x ``source_code`` single-file mode was removed in 2.0.)

#### `CLDK.python`

Expand Down Expand Up @@ -266,34 +262,26 @@ Create a TypeScript analysis facade.
| `analysis_level` | `str` | Analysis depth (see `AnalysisLevel`). |
| `target_files` | `List[str] \| None` | Restrict analysis to these files. |
| `eager` | `bool` | Force regeneration of cached analysis. |
| `backend` | `TSBackend \| None` | Backend configuration. Defaults to `CodeAnalyzerConfig`; pass a `TSCodeAnalyzerConfig` to set TypeScript-only knobs such as ``tsc_only`` (passes ``--tsc-only``), or a `Neo4jConnectionConfig` to use the read-only Neo4j backend. |

#### `CLDK.c`

```python
c(project_path: str | Path) -> CAnalysis
```

Create a C analysis facade for the given project directory.
| `backend` | `TSBackend \| None` | Backend configuration. Defaults to `CodeAnalyzerConfig`; pass a `TSCodeAnalyzerConfig` (its ``tsc_only`` is a deprecated no-op, codeanalyzer-typescript removed ``--tsc-only`` in 1.0.0), or a `Neo4jConnectionConfig` to use the read-only Neo4j backend. |

#### `CLDK.analysis`

```python
analysis(project_path: str | Path | None = None, source_code: str | None = None, eager: bool = False, analysis_level: str = AnalysisLevel.symbol_table, target_files: List[str] | None = None, analysis_backend_path: str | None = None, analysis_json_path: str | Path | None = None, cache_dir: str | Path | None = None, use_ray: bool = False, neo4j_config: Neo4jConnectionConfig | None = None) -> JavaAnalysis | PythonAnalysis | CAnalysis | TypeScriptAnalysis
analysis(project_path: str | Path | None = None, source_code: str | None = None, eager: bool = False, analysis_level: str = AnalysisLevel.symbol_table, target_files: List[str] | None = None, analysis_backend_path: str | None = None, analysis_json_path: str | Path | None = None, cache_dir: str | Path | None = None, use_ray: bool = False, neo4j_config: Neo4jConnectionConfig | None = None) -> JavaAnalysis | PythonAnalysis | TypeScriptAnalysis
```

Deprecated entry point. Use the per-language factory methods instead.

``CLDK(language).analysis(...)`` is retained as a thin compatibility shim that forwards to
`java` / `python` / `typescript` / `c` with an appropriate
`java` / `python` / `typescript` with an appropriate
``backend=`` configuration object.

The former ``analysis_json_path`` is folded into the unified ``cache_dir`` (it is used as
the cache root when ``cache_dir`` is not given). ``analysis_backend_path`` is no longer
supported: the backend binary ships with the packaged dependency, and passing it is ignored.

.. deprecated::
Use `java`, `python`, `typescript`, or `c`
Use `java`, `python`, or `typescript`
with a ``backend=<config>`` object.

#### `CLDK.treesitter_parser`
Expand Down
Loading