skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
dkyazzentwatwa/chatgpt-skills58 installs

dependency-analyzer

Analyze Python imports and dependencies. Use to understand project structure, find unused imports, or generate requirements.txt files.

How do I install this agent skill?

npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill dependency-analyzer
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill is a documentation-only package for a Python dependency analysis tool. It contains no executable code and relies on the standard library for its described functionality.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    3/3 files flagged

What does this agent skill do?

Dependency Analyzer

Analyze Python file imports and project dependencies.

Features

  • Import Extraction: List all imports from Python files
  • Dependency Graph: Visualize import relationships
  • Unused Detection: Find unused imports
  • Requirements Generation: Auto-generate requirements.txt
  • Standard Library Detection: Separate stdlib from third-party
  • Circular Import Detection: Find circular dependencies

Quick Start

from dependency_analyzer import DependencyAnalyzer

analyzer = DependencyAnalyzer()

# Analyze single file
imports = analyzer.analyze_file("main.py")
print(imports)

# Analyze project
result = analyzer.analyze_project("./src")
print(result['third_party'])  # External dependencies

CLI Usage

# Analyze single file
python dependency_analyzer.py --file main.py

# Analyze project directory
python dependency_analyzer.py --dir ./src

# Generate requirements.txt
python dependency_analyzer.py --dir ./src --requirements --output requirements.txt

# Find unused imports
python dependency_analyzer.py --file main.py --unused

# Show dependency graph
python dependency_analyzer.py --dir ./src --graph

# JSON output
python dependency_analyzer.py --dir ./src --json

API Reference

DependencyAnalyzer Class

class DependencyAnalyzer:
    def __init__(self)

    # Analysis
    def analyze_file(self, filepath: str) -> dict
    def analyze_project(self, directory: str) -> dict

    # Detection
    def find_unused_imports(self, filepath: str) -> list
    def find_circular_imports(self, directory: str) -> list

    # Generation
    def generate_requirements(self, directory: str) -> list
    def save_requirements(self, deps: list, output: str)

    # Classification
    def is_stdlib(self, module: str) -> bool
    def is_local(self, module: str, directory: str) -> bool

Output Format

File Analysis

{
    "file": "main.py",
    "imports": [
        {"module": "os", "type": "stdlib", "line": 1},
        {"module": "json", "type": "stdlib", "line": 2},
        {"module": "requests", "type": "third_party", "line": 3},
        {"module": "utils.helpers", "type": "local", "line": 4}
    ],
    "from_imports": [
        {"module": "typing", "names": ["Dict", "List"], "type": "stdlib"},
        {"module": "flask", "names": ["Flask", "request"], "type": "third_party"}
    ]
}

Project Analysis

{
    "directory": "./src",
    "files_analyzed": 15,
    "stdlib": ["os", "sys", "json", "typing", ...],
    "third_party": ["requests", "flask", "pandas", ...],
    "local": ["utils", "models", "config", ...],
    "by_file": {
        "main.py": {...},
        "app.py": {...}
    }
}

Example Workflows

Generate Requirements

analyzer = DependencyAnalyzer()
deps = analyzer.generate_requirements("./src")
analyzer.save_requirements(deps, "requirements.txt")

Find Unused Imports

analyzer = DependencyAnalyzer()
unused = analyzer.find_unused_imports("main.py")
for imp in unused:
    print(f"Line {imp['line']}: {imp['module']} is unused")

Analyze Project Structure

analyzer = DependencyAnalyzer()
result = analyzer.analyze_project("./myproject")

print("Third-party dependencies:")
for dep in result['third_party']:
    print(f"  - {dep}")

print("\nLocal modules:")
for mod in result['local']:
    print(f"  - {mod}")

Check for Circular Imports

analyzer = DependencyAnalyzer()
circular = analyzer.find_circular_imports("./src")
if circular:
    print("Circular imports detected:")
    for cycle in circular:
        print(f"  {' -> '.join(cycle)}")

Module Classification

TypeDescriptionExample
stdlibPython standard libraryos, sys, json
third_partyExternal packagesrequests, pandas
localProject modulesutils.helpers

Dependencies

No external dependencies - uses Python standard library (ast module).

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/dkyazzentwatwa/chatgpt-skills/dependency-analyzer">View dependency-analyzer on skillZs</a>