-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation of Module Dependency Visualization Enhancements #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Implementation of Module Dependency Visualization Enhancements #134
Conversation
# Motivation The **Codegen on OSS** package provides a pipeline that: - **Collects repository URLs** from different sources (e.g., CSV files or GitHub searches). - **Parses repositories** using the codegen tool. - **Profiles performance** and logs metrics for each parsing run. - **Logs errors** to help pinpoint parsing failures or performance bottlenecks. <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> see [codegen-on-oss/README.md](https://github.com/codegen-sh/codegen-sdk/blob/acfe3dc07b65670af33b977fa1e7bc8627fd714e/codegen-on-oss/README.md) # Testing <!-- How was the change tested? --> `uv run modal run modal_run.py` No unit tests yet 😿 # Please check the following before marking your PR as ready for review - [ ] I have added tests for my changes - [x] I have updated the documentation or added new documentation as needed
Original commit by Tawsif Kamal: Revert "Revert "Adding Schema for Tool Outputs"" (codegen-sh#894) Reverts codegen-sh#892 --------- Co-authored-by: Rushil Patel <[email protected]> Co-authored-by: rushilpatel0 <[email protected]>
Original commit by Ellen Agarwal: fix: Workaround for relace not adding newlines (codegen-sh#907)
Reviewer's GuideThis PR introduces a comprehensive ModuleDependencyGraph implementation for detailed module dependency analysis and visualization, extends the existing viz_utils with new utilities, integrates the new graph type into the visualization manager, updates documentation and examples with enhanced visualization workflows, and adds end-to-end unit tests for the new features. Sequence Diagram for Building Module Dependency GraphsequenceDiagram
actor User
participant BMDG as build_module_dependency_graph
participant MDG as ModuleDependencyGraph
participant SF as SourceFile
User->>BMDG: build_module_dependency_graph(files, include_external, path_filter)
activate BMDG
BMDG->>MDG: __init__()
activate MDG
deactivate MDG
loop For each file in files
BMDG->>MDG: add_module(file)
activate MDG
deactivate MDG
BMDG->>SF: get import_statements
loop For each import in file
BMDG->>SF: get resolved_symbol
alt Internal dependency
BMDG->>MDG: add_dependency(file, target_file, import_obj)
activate MDG
deactivate MDG
end
end
end
BMDG->>MDG: detect_circular_dependencies()
activate MDG
MDG-->>BMDG: circular_dependencies_list
deactivate MDG
BMDG-->>User: module_dependency_graph_instance
deactivate BMDG
Class Diagram for Module Dependency Visualization EnhancementsclassDiagram
class ModuleDependencyGraph {
+graph: DiGraph
+modules: Dict
+dependencies: Dict
+circular_dependencies: List
+__init__()
+add_module(module, attributes)
+add_dependency(source_module, target_module, import_obj, attributes)
+detect_circular_dependencies(): List[List[str]]
+filter_by_module_path(path_prefix: str): ModuleDependencyGraph
+filter_by_depth(root_module, max_depth: int): ModuleDependencyGraph
+get_module_metrics(): Dict
+to_visualization_graph(): DiGraph
+to_json(root): str
}
note for ModuleDependencyGraph "Manages module dependencies and their visualization properties."
class VisualizationManager {
+write_graphviz_data(G: Union[Graph, go.Figure, ModuleDependencyGraph], root: Optional[Union[Editable, str, int]])
}
note for VisualizationManager "Handles writing graph data for visualization. write_graphviz_data now supports ModuleDependencyGraph."
ModuleDependencyGraph ..> DiGraph : uses
VisualizationManager ..> ModuleDependencyGraph : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
I see a check failed - I'm on it! 🫡 |
✅ Fixed the failing check in PR #134. The issue was a bare The fix has been pushed to the PR branch in this commit. 💻 View my work • React 👍 or 👎 |
I see a check failed - I'm on it! 🫡 |
✅ Fixed the failing check suite in PR #134. The issues were:
The fix has been pushed to the PR branch in this commit. 💻 View my work • React 👍 or 👎 |
This PR implements enhanced module dependency visualization features for the Codegen repository as specified in issue ZAM-424.
Features Implemented
Enhanced Module Dependency Visualization
ModuleDependencyGraph
class for detailed module dependency analysisInteractive Features
Improved Visual Representation
Documentation and Examples
Testing
Files Modified
src/codegen/visualizations/module_dependency_viz.py
(new file)src/codegen/visualizations/visualization_manager.py
src/codegen/visualizations/viz_utils.py
codegen-examples/examples/modules_dependencies/enhanced_module_viz.py
(new file)docs/building-with-codegen/codebase-visualization.mdx
tests/codegen/visualizations/test_module_dependency_viz.py
(new file)Resolves ZAM-424
💻 View my work • About Codegen
Summary by Sourcery
Implement enhanced module dependency visualization by introducing a dedicated graph class with analysis, filtering, and styling capabilities, integrating it into the visualization manager, and providing documentation, examples, and tests for interactive codebase visualization.
New Features:
Enhancements:
Documentation:
Tests: