Skip to content

Python API Reference

Source on GitHub

Every CLDK program follows the same shape. Call the per-language factory, for example CLDK.java(project_path=...), to get an analysis object over your project. Then call typed methods that return data models.

flowchart LR
    C["CLDK"] --> JF["CLDK.java(project_path)"]
    C --> PF["CLDK.python(project_path)"]
    JF --> J[JavaAnalysis]
    PF --> P[PythonAnalysis]
    J & P --> M[Typed models]

The analysis API and its methods are the same across languages. Only the factory that you call changes. For an introduction to the library, see What is CLDK?, or the Quickstart.

  • Core (CLDK), the factory: the per-language CLDK.java(), CLDK.python(), and CLDK.typescript() entry points.
  • Python analysis: symbol table and call graph, from Jedi and the level-2 defuse linker.
  • Java analysis, the most complete analysis: symbol table, call graph, subclasses, and interfaces.
  • TypeScript analysis: symbol table, call graph, interfaces, enums, decorators, and framework entrypoints. It also analyzes JavaScript sources.

CLDK 2.0 adds the dataflow and taint methods to all three. See Dataflow graphs. Go and Rust are planned.

For runnable patterns rather than symbol lists, see Common tasks and the cocoa.