Crate codegraph_python

Crate codegraph_python 

Source
Expand description

§codegraph-python

Python parser plugin for CodeGraph - extracts code entities and relationships from Python source files.

§Features

  • Parse single Python files or entire projects
  • Extract functions, classes, methods with full metadata
  • Track relationships (calls, imports, inheritance)
  • Configurable behavior (visibility filtering, parallel processing)
  • Safe: No panics, graceful error handling

§Quick Start (New API - v0.2.0+)

use codegraph_python::PythonParser;
use codegraph_parser_api::CodeParser;
use codegraph::CodeGraph;
use std::path::Path;

let mut graph = CodeGraph::in_memory()?;
let parser = PythonParser::new();

let file_info = parser.parse_file(Path::new("example.py"), &mut graph)?;
println!("Parsed {} functions", file_info.functions.len());

§Legacy API (Deprecated in v0.2.0)

use codegraph_python::Parser;

// This API is deprecated - use PythonParser with CodeParser trait instead
let parser = Parser::new();

Re-exports§

pub use config::ParserConfig;
pub use error::ParseError;
pub use error::Result;

Modules§

config
error

Structs§

ApiFileInfo
Information about a successfully parsed file
ApiParserConfig
Configuration for parser behavior
ApiProjectInfo
Aggregate information about a parsed project
FileInfo
Information about a parsed file
Parser
Main parser for Python source code
ProjectInfo
Information about a parsed project
PythonParser
Python language parser implementing the CodeParser trait

Enums§

ParserError
Errors that can occur during parsing

Traits§

CodeParser
Core trait that all language parsers must implement