Skip to content

Commit 0b6244c

Browse files
committed
Release 1.3.0
1 parent 9bfc073 commit 0b6244c

21 files changed

+1042
-374
lines changed

ARCHITECTURE.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ codegraph/
1414
│ ├── __init__.py # Package init, version definition
1515
│ ├── main.py # CLI entry point (click-based)
1616
│ ├── core.py # Core graph building logic
17-
│ ├── parser.py # Python source code parser
17+
│ ├── parser.py # Python token parser (legacy, used by PythonParser)
18+
│ ├── parsers/ # Pluggable language parsers
19+
│ │ ├── base.py # Parser interface
20+
│ │ ├── python_parser.py # Python parser implementation
21+
│ │ ├── rust_parser.py # Rust parser stub
22+
│ │ ├── registry.py # Parser registry / discovery
1823
│ ├── utils.py # Utility functions
1924
│ └── vizualyzer.py # Visualization (D3.js + matplotlib)
2025
├── tests/ # Test suite
@@ -30,9 +35,25 @@ codegraph/
3035

3136
## Core Components
3237

33-
### 1. Parser (`codegraph/parser.py`)
38+
### 1. Parser Layer (`codegraph/parsers/`)
3439

35-
The parser uses Python's `tokenize` module to extract code structure from source files.
40+
Parser implementations are pluggable via a registry. Each parser exposes:
41+
- `get_source_files()` for language-specific file discovery
42+
- `parse_files()` to produce module objects
43+
- `usage_graph()` to build dependencies
44+
- `get_entity_metadata()` for entity stats
45+
46+
This allows adding new languages without changing core graph orchestration.
47+
48+
#### Python Parser (`codegraph/parsers/python_parser.py`)
49+
50+
Uses Python's `ast` (and `typed_ast` for Python 2.x) to extract classes, functions,
51+
imports, and line ranges.
52+
53+
#### Rust Parser (`codegraph/parsers/rust_parser.py`)
54+
55+
Currently a stub to establish extension points. The intent is to parse `.rs` files,
56+
extract functions/structs/impl blocks, and build dependency edges using a Rust-aware parser.
3657

3758
**Key Classes:**
3859
- `_Object` - Base class for all parsed objects (lineno, endno, name, parent)
@@ -52,16 +73,15 @@ The parser uses Python's `tokenize` module to extract code structure from source
5273

5374
### 2. Core (`codegraph/core.py`)
5475

55-
The core module builds the dependency graph from parsed data.
76+
The core module orchestrates parsing and visualization by delegating language-specific
77+
work to the selected parser.
5678

5779
**Key Classes:**
5880
- `CodeGraph` - Main class that orchestrates graph building
5981

6082
**Key Functions:**
61-
- `get_code_objects(paths_list)` - Parse all files and return dict of module → objects
62-
- `get_imports_and_entities_lines()` - Extract imports and entity line ranges
63-
- `collect_entities_usage_in_modules()` - Find where entities are used
64-
- `search_entity_usage()` - Check if entity is used in a line
83+
- `usage_graph()` - Delegates to the active parser
84+
- `get_entity_metadata()` - Delegates to the active parser
6585

6686
**Data Flow:**
6787
```

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.0] - 2026-01-24
9+
10+
### Added
11+
12+
- Pluggable parser architecture with registry and base parser interface
13+
- Rust parser stub to establish language extension points
14+
- AST-based Python parser with cross-version parsing support (Python 2.x via typed-ast)
15+
- CLI options for language selection and target Python version
16+
- Expanded test coverage for parsers, registry/utils, visualizer helpers, and legacy parser objects
17+
18+
### Changed
19+
20+
- Core now delegates parsing and dependency analysis to language parsers
21+
- Python dependency detection now uses AST rather than token scanning
22+
- Utilities now support multi-extension file discovery
23+
24+
### Fixed
25+
26+
- Legacy parser now handles comma-separated imports in a single statement
27+
- Removed known false positives from string literals and alias leakage (AST parser)
28+
829
## [1.2.0] - 2026-01-18
930

1031
### Added

codegraph/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.0"
1+
__version__ = "1.3.0"

0 commit comments

Comments
 (0)