{"library":"pydeps","title":"pydeps","description":"pydeps is a Python library and command-line tool for visualizing module dependencies within Python projects. It analyzes import statements to build a dependency graph and can output it in various formats (e.g., SVG, PNG) using Graphviz. The current version is 3.0.2, and it follows an active release cadence, often updating for Python compatibility or bug fixes.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pydeps"],"cli":{"name":"pydeps","version":"pydeps v3.0.6"}},"imports":["from pydeps import cli","from pydeps.pydeps import externals","from pydeps.depgraph import DepGraph"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport subprocess\nimport tempfile\n\ndef create_sample_project(path):\n    os.makedirs(os.path.join(path, 'mypackage'), exist_ok=True)\n    with open(os.path.join(path, 'mypackage', '__init__.py'), 'w') as f:\n        f.write('')\n    with open(os.path.join(path, 'mypackage', 'module_a.py'), 'w') as f:\n        f.write('import os\\nfrom . import module_b\\ndef func_a():\\n    print(\"Hello from A\")')\n    with open(os.path.join(path, 'mypackage', 'module_b.py'), 'w') as f:\n        f.write('import sys\\ndef func_b():\\n    print(\"Hello from B\")')\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n    create_sample_project(tmpdir)\n    current_dir = os.getcwd()\n    os.chdir(tmpdir)\n    \n    try:\n        # Run pydeps as a subprocess to generate the dependency graph\n        # Output to stdout and catch errors\n        result = subprocess.run(\n            ['pydeps', 'mypackage', '--nodot', '--no-output', '--show-deps'],\n            capture_output=True, text=True, check=True\n        )\n        print(\"\\n--- pydeps output (dependencies) ---\")\n        print(result.stdout)\n        \n        # To generate an SVG file, you'd typically run:\n        # subprocess.run(['pydeps', 'mypackage', '-o', 'mypackage.svg'], check=True)\n        # print(f\"Dependency graph saved to {os.path.join(tmpdir, 'mypackage.svg')}\")\n        \n    except FileNotFoundError:\n        print(\"Error: 'pydeps' command not found. Ensure pydeps is installed and in PATH.\")\n        print(\"Error: 'dot' command (from Graphviz) might also be missing. Install Graphviz.\")\n    except subprocess.CalledProcessError as e:\n        print(f\"Error running pydeps: {e}\")\n        print(f\"Stdout: {e.stdout}\")\n        print(f\"Stderr: {e.stderr}\")\n    finally:\n        os.chdir(current_dir)\n","lang":"python","description":"This quickstart demonstrates how to use pydeps from the command line (via subprocess) to visualize module dependencies. It creates a temporary Python package, runs pydeps on it, and prints the raw dependency list. To generate a visual graph (e.g., SVG), ensure Graphviz is installed and remove the `--nodot --no-output` flags, using `-o filename.svg` instead.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"3.0.2","pypi_latest":"3.0.6","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.6,"avg_import_s":0.06,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.03,"mem_mb":1.6,"disk_size":"18.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.02,"mem_mb":1.6,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.11,"mem_mb":3.3,"disk_size":"20.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.1,"mem_mb":3.3,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.07,"mem_mb":2.5,"disk_size":"12.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.07,"mem_mb":2.5,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.07,"mem_mb":2.6,"disk_size":"12.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.06,"mem_mb":2.4,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.03,"mem_mb":1.6,"disk_size":"18.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pydeps","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.03,"mem_mb":1.6,"disk_size":"18M"}]}}