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§
Structs§
- ApiFile
Info - Information about a successfully parsed file
- ApiParser
Config - Configuration for parser behavior
- ApiProject
Info - Aggregate information about a parsed project
- File
Info - Information about a parsed file
- Parser
- Main parser for Python source code
- Project
Info - Information about a parsed project
- Python
Parser - Python language parser implementing the CodeParser trait
Enums§
- Parser
Error - Errors that can occur during parsing
Traits§
- Code
Parser - Core trait that all language parsers must implement