-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlib.rs
More file actions
75 lines (68 loc) · 2.11 KB
/
Copy pathlib.rs
File metadata and controls
75 lines (68 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2024-2026 Andrey Vasilevsky <anvanster@gmail.com>
// SPDX-License-Identifier: Apache-2.0
//! # 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+)
//!
//! ```rust,no_run
//! use codegraph_python::PythonParser;
//! use codegraph_parser_api::CodeParser;
//! use codegraph::CodeGraph;
//! use std::path::Path;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! 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());
//! # Ok(())
//! # }
//! ```
//!
//! ## Legacy API (Deprecated in v0.2.0)
//!
//! ```rust,no_run,ignore
//! use codegraph_python::Parser;
//!
//! // This API is deprecated - use PythonParser with CodeParser trait instead
//! let parser = Parser::new();
//! ```
//!
//! **Author:** Andrey Vasilevsky \<anvanster@gmail.com\>
//! **License:** Apache-2.0
//! **Repository:** <https://github.com/anvanster/codegraph>
// Keep old config and error for backward compatibility with deprecated API
pub mod config;
pub mod error;
mod builder;
mod extractor;
mod parser;
mod parser_impl;
mod visitor;
// Re-export parser-api types for convenience
pub use codegraph_parser_api::{
CodeParser, FileInfo as ApiFileInfo, ParserConfig as ApiParserConfig, ParserError,
ProjectInfo as ApiProjectInfo,
};
// Export new parser implementation
pub use parser_impl::PythonParser;
// Legacy exports (deprecated)
pub use config::ParserConfig;
pub use error::{ParseError, Result};
#[deprecated(
since = "0.2.0",
note = "Use PythonParser with CodeParser trait instead"
)]
pub use parser::{FileInfo, Parser, ProjectInfo};