Agents/Developer tools
cargo-perspective
The Surveyor
Shows which dependencies your code actually calls, as a treemap.
Downloads per day
Last 90 days · 9 total · peak 8
Dossier
What cargo-perspective does.
Scans a Rust project's source and draws an interactive treemap of how often each dependency is called (not just declared).
From the crate: “A utility that graphically shows the crate dependency distribution within a project.”
- Codename
- The Surveyor
- Role
- Dependency treemap
- Character
- Measures before it judges. Will point out, politely, that you call that big dependency exactly twice.
- Domain
- Developer tools
- Enlisted
- 8 October 2026
- Last release
- v0.1.0, 8 October 2026
- Keywords
dependencies,gui,optimization
Use cases
Put it to work.
- Find dependencies that are declared but barely used.
- See at a glance which crates your project leans on most.
- Check a dependency diet before a release.
Getting started
Call it in.
Add it to a Rust project, then follow the example. The full API is on docs.rs.
Install
cargo add cargo-perspective cargo install cargo-perspective
Example
cargo-perspective/ ├── src/ │ ├── analysis.rs # AST-based call counting using syn │ ├── treemap.rs # Squarified TreeMap layout algorithm │ ├── types.rs # Core data structures (ProjectAnalysis, TreeMapNode, etc.) │ ├── ui.rs # Dioxus desktop UI │ └── main.rs # CLI entry point └── Cargo.toml
More
--skip-build Skip the initial cargo build step --gui Launch interactive TreeMap visualization (default) --text Show text-based analysis report
Build with a prompt
Add the Rust crate `cargo-perspective` (version 0.1.0) to this project with `cargo add cargo-perspective`. I want to use it for this: Scans a Rust project's source and draws an interactive treemap of how often each dependency is called (not just declared). Before writing code, read its README at https://crates.io/crates/cargo-perspective and the API docs at https://docs.rs/cargo-perspective. Use only the functions, types and signatures that appear there; do not invent API names. Write a minimal working example and one test that runs it.
Paste this into Claude Code or another coding agent.
Specs
- Version
- 0.1.0
- License
- MIT
- Edition
- Rust 2024
- Size
- 1,103 lines of code, 76 of comments
- Package
- 49.9 KB compressed
- Dependencies
- anyhow, cargo_metadata, clap, dioxus, dioxus-desktop, quote, regex, serde, serde_json, syn, tracing, tracing-subscriber, walkdir
- Used by
- 0 crates on crates.io
- Binaries
- cargo-perspective
- Docs
- docs.rs, built
- Repository
- cryptopatrick/cargo-perspective · 0★ · 0 forks · 0 open issues · pushed 16 Nov 2025
Release history
| Version | Date | Downloads |
|---|---|---|
| 0.1.0 | 8 Oct 2026 | 9 |
Documentation
The manual.
The crate's README as published on crates.io. The full API reference is on docs.rs.
Read the README
Cargo Perspective
A visual TreeMap analyzer for Rust dependency usage
Inspired by GrandPerspective, Cargo Perspective helps you understand which dependencies your Rust project uses most by visualizing them in an interactive TreeMap.
Overview
Cargo Perspective analyzes your Rust project's dependencies and visualizes how often each crate is called throughout your codebase. Unlike traditional dependency trees, it shows you actual usage patterns, not just the dependency graph.
Each rectangle in the TreeMap represents a crate, sized proportionally to how many times it's called in your code. This helps you:
- Identify which dependencies are actually used (vs. just declared)
- Spot over-reliance on specific crates
- Find opportunities to optimize or reduce dependencies
- Understand your project's true dependency footprint
Key Features
MVP (v0.1) - ✅ Complete
- AST-based call analysis: Scans Rust source files to count function, method, and macro calls to dependencies
- Interactive TreeMap visualization: Built with Dioxus, showing crates as rectangles sized by call count
- Hover tooltips: Display crate name, call count, and dependency type (direct/transitive)
- Zoom functionality: Click on a crate to zoom into its methods (future enhancement)
- CLI and GUI modes:
--gui: Launch interactive TreeMap (default)--text: Legacy text-based report mode (from deppy.sh)
Planned Features
- v0.2: Color coding by execution time (green = fast, red = slow), transitive dep filtering
- v0.3: AI-assisted call pattern analysis, feature-level breakdowns
- v1.0: Export to PNG/SVG, persistent caching, workspace support
Architecture
cargo-perspective/
├── src/
│ ├── analysis.rs # AST-based call counting using syn
│ ├── treemap.rs # Squarified TreeMap layout algorithm
│ ├── types.rs # Core data structures (ProjectAnalysis, TreeMapNode, etc.)
│ ├── ui.rs # Dioxus desktop UI
│ └── main.rs # CLI entry point
└── Cargo.toml
Quick Start
# Clone the repository
git clone https://github.com/cryptopatrick/cargo-perspective
cd cargo-perspective
# Build the project
cargo build --release
# Run on your Rust project
cargo-perspective --gui
# Or use text mode for quick stats
cargo-perspective --text
Options
--skip-build Skip the initial cargo build step
--gui Launch interactive TreeMap visualization (default)
--text Show text-based analysis report
How It Works
- Metadata Collection: Uses
cargo metadatato build the dependency graph - AST Analysis: Parses all
.rsfiles withsynto detect calls like:- Function calls:
tokio::spawn(...) - Method calls:
stream.read_to_end() - Macros:
println!,tokio::select!
- Function calls:
- TreeMap Layout: Applies squarified TreeMap algorithm for optimal rectangle aspect ratios
- Visualization: Renders with Dioxus in a native desktop window
Examples
# Analyze this project itself
cd cargo-perspective
cargo run --bin cargo-perspective -- --skip-build --gui
# Output:
# Analyzing project dependencies...
# Found 3 crates with 3 total calls
# Launching GUI...
#
# [TreeMap shows: cargo_metadata (50%), anyhow (16.7%), regex (16.7%), etc.]
The original bash script (_dev/deppy.sh) is now available as --text mode for quick terminal-based analysis.
Contributing
Contributions are welcome! Please see our contributing guidelines for details on:
- Code style and testing requirements
- Submitting bug reports and feature requests
- Development setup and workflow
License
This project is licensed under MIT. See LICENSE for details.
Resources
Same unit
Other agents.
-
alarmA type system and procedural macros for alarm system functionality, based on the EE191 standard.
-
arrangeConvenience functions for populating an array with values from a range.
-
cargo-rushcargo run whatever is on the operating system clipboard.
-
cargo-x402Scaffold x402 projects from templates.