Crates.io | pydep-mapper |
lib.rs | pydep-mapper |
version | 0.1.5 |
created_at | 2025-08-16 14:44:56.786691+00 |
updated_at | 2025-08-18 19:10:50.469116+00 |
description | Fast Rust CLI for analyzing Python dependencies with external package declarations support. |
homepage | https://github.com/az-fouche/dep-mapper-rust/ |
repository | https://github.com/az-fouche/dep-mapper-rust/ |
max_upload_size | |
id | 1798528 |
size | 264,851 |
A fast Rust CLI tool for analyzing Python codebases and mapping module dependencies. Designed for both human engineers and AI coding assistants to understand, maintain, and refactor large Python projects.
git clone <repository-url>
cd pydep-mapper-rust
cargo build --release
cargo install pydep-mapper
The commands should be launched at the root of your python project, where your pyproject.toml
is located.
# Check what modules depend on a specific module (blast radius analysis)
pydep-mapper impact src.payments.processor
# Check what modules a specific module depends on
pydep-mapper dependencies src.payments.processor
# Find all circular dependencies
pydep-mapper cycles
# Analyze external dependencies (includes packages from .used-externals.txt if present)
pydep-mapper external
# Show modules with most dependencies (pressure points), can be combined with grep or head
pydep-mapper pressure
# General analysis of a Python codebase
pydep-mapper analyze
# See what breaks if you change this module
pydep-mapper impact src.payments.processor
# Output:
# Modules depending on 'src.payments.processor':
# - src.api.billing (Imports)
# - src.services.subscription (Imports)
# - tests.test_payments (Imports)
# Total: 3 modules affected
# See what a module depends on
pydep-mapper dependencies src.payments.processor
# Output:
# Dependencies of 'src.payments.processor':
# - stripe (External - Imports)
# - src.models.payment (Internal - Imports)
# - src.utils.validation (Internal - Imports)
# Total: 3 dependencies (1 external, 2 internal)
# Analyze external dependencies
pydep-mapper external
# Output includes both code-detected and manually declared packages:
# External Dependencies Analysis:
#
# === Summary ===
# Total external packages used: 127
# Manually declared externals: 10
Manual Package Declarations: Create a .used-externals.txt
file in the same directory as your pyproject.toml
to declare additional packages that should be considered "used" even if not directly imported in code:
# .used-externals.txt
# Build tools
setuptools
wheel
# Runtime dependencies not directly imported
redis # Used via config
docker # Used in deployment
# Development tools
ruff
mypy # Type checker
Features of .used-externals.txt
:
#
(full-line or inline)# Check for circular dependencies
pydep-mapper cycles
# Get overall metrics (coming soon™)
pydep-mapper metrics
# Find potential dead code (coming soon™)
pydep-mapper orphans
rustpython-parser
for AST-based parsingimport module
from module import name
from module import *
import numpy as np
)The tool builds a dependency graph with three relationship types:
rustpython-parser
- Python AST parsingpetgraph
- Graph data structures and algorithmsclap
- Command line interfacewalkdir
- File system traversalanyhow
- Error handlingserde
- Serialization for JSON outputindicatif
- Progress barscargo build
cargo run -- analyze /path/to/project
cargo test
cargo clippy
cargo fmt