Skip to content

Add file-level dependency visualization support#78

Open
mircealungu wants to merge 3 commits intomasterfrom
feature/file-level-dependencies
Open

Add file-level dependency visualization support#78
mircealungu wants to merge 3 commits intomasterfrom
feature/file-level-dependencies

Conversation

@mircealungu
Copy link
Copy Markdown
Contributor

Summary

  • Enable showing individual Python files as nodes in architecture diagrams (not just packages/modules)
  • Add new files config key to explicitly include specific files as nodes
  • Files render as white rectangles with .py suffix to distinguish from packages
  • Strip common prefix from all node labels and show it in the diagram title for cleaner visualization

Technical Changes

  • bt_file.py: Add ViewPackage compatibility (path, depth, name properties), resolve relative imports (from .module import), detect imports inside functions/classes using nodes_of_class()
  • bt_graph.py: Add get_all_bt_files_as_nodes_map() method
  • view_entities.py: Make ViewPackage polymorphic to accept both BTModule and BTFile, add parent-path fallback for dependency matching
  • view_manager.py: Add _get_requested_files() helper, only create file nodes when explicitly requested
  • pu_render.py: Extract common prefix from node names and display in title

Example Config

"llm-services-files": {
  "packages": ["core.llm_services.prompts"],
  "files": [
    "core.llm_services.anthropic_service",
    "core.llm_services.llm_service"
  ]
}

Test plan

  • Verify existing package-only views still render correctly
  • Verify new file nodes appear with .py suffix and white background
  • Verify dependencies from files to packages are detected
  • Verify relative imports inside functions are detected

🤖 Generated with Claude Code

mircealungu and others added 3 commits December 5, 2025 11:12
Replace parenthetical (+N)/(-N) dependency change indicators with colored
triangle symbols: green ▲ for increases, red ▼ for decreases. Also increase
the thickness of colored diff lines to 2px for better visibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…theses

- Move triangle indicator to new line below dependency count
- Make indicator text smaller (size 10) and bold
- Wrap indicator in parentheses for clarity

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Enable showing individual Python files as nodes in architecture diagrams,
not just packages/modules. This helps visualize dependencies at a more
granular level.

Key changes:
- Add "files" config key to explicitly include specific files as nodes
- Files render as white rectangles with .py suffix (distinct from packages)
- Strip common prefix from all node labels, show in diagram title
- Fix relative import resolution (from .module import)
- Detect imports inside functions/classes, not just top-level
- Add parent-path fallback for dependency matching

Example config:
  "llm-services-files": {
    "packages": ["core.llm_services.prompts"],
    "files": [
      "core.llm_services.anthropic_service",
      "core.llm_services.llm_service"
    ]
  }

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 5, 2025

ArchLens detected architectural changes in the following views:
diff

lottejd pushed a commit that referenced this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant