{"library":"pykdebugparser","title":"pykdebugparser","description":"pykdebugparser is a Python library designed to parse Darwin's (iOS and macOS) kdebug events and ktraces. It provides utilities to convert raw kdebug dumps into meaningful traces, offering a more formatted output compared to tools like `fs_usage` or `ktrace`. Currently at version 1.2.7, the library is actively maintained with frequent updates for bug fixes, compatibility with newer Python versions, and expanded event handling.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pykdebugparser"],"cli":null},"imports":["from pykdebugparser.pykdebugparser import PyKdebugParser"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pykdebugparser.pykdebugparser import PyKdebugParser\n\n# Create a dummy kdebug.bin for demonstration if it doesn't exist\ndummy_kdebug_path = 'kdebug.bin'\nif not os.path.exists(dummy_kdebug_path):\n    print(f\"Creating a dummy '{dummy_kdebug_path}' file for quickstart example.\")\n    # A minimal, valid kdebug header (approximate structure, might not be fully functional)\n    # This is highly simplified and for demonstration purposes only.\n    # Real kdebug files require specific kernel structures.\n    # For a real trace, use `sudo ktrace dump` on macOS.\n    dummy_content = b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00' * 10 # Simulate some binary data\n    with open(dummy_kdebug_path, 'wb') as f:\n        f.write(dummy_content)\n\nparser = PyKdebugParser()\nparser.color = True # Enable colored output\n\ntry:\n    with open(dummy_kdebug_path, 'rb') as f:\n        # In a real scenario, you'd iterate over parsed events or traces\n        # For this quickstart, we'll just demonstrate opening and a basic print.\n        print(f\"Attempting to parse '{dummy_kdebug_path}'...\")\n        # Note: Actual parsing methods (e.g., parser.parse_file, parser.parse_traces)\n        # would be used here. This example focuses on instantiation and file handling.\n        # If the dummy file is too simple, parse_events might return nothing or error.\n        # We'll just print a success message for file opening.\n        print(f\"Successfully opened '{dummy_kdebug_path}'. Further parsing requires valid kdebug data.\")\n        # Example of attempting to parse (may not yield meaningful results with dummy data)\n        # events = parser.parse_file(f)\n        # for event in events:\n        #     print(event)\nexcept FileNotFoundError:\n    print(f\"Error: The file '{dummy_kdebug_path}' was not found. Please ensure it exists or create a real kdebug dump using `sudo ktrace dump` on macOS.\")\nexcept Exception as e:\n    print(f\"An error occurred during parsing: {e}\")\nfinally:\n    # Clean up dummy file\n    if os.path.exists(dummy_kdebug_path) and dummy_kdebug_path == 'kdebug.bin' and b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00' * 10 in open(dummy_kdebug_path, 'rb').read():\n        os.remove(dummy_kdebug_path)\n        print(f\"Cleaned up dummy '{dummy_kdebug_path}'.\")\n","lang":"python","description":"Initialize the PyKdebugParser and attempt to open a kdebug trace file. The example includes creating a simple dummy file for demonstration purposes if a real kdebug.bin is not present. For actual usage, generate a trace using `sudo ktrace dump` on a macOS system.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"1.2.7","pypi_latest":"1.2.7","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.5,"avg_import_s":1.06,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.83,"mem_mb":11.7,"disk_size":"28.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.3,"import_time_s":0.53,"mem_mb":11.7,"disk_size":"29M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.67,"mem_mb":13.3,"disk_size":"32.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.5,"import_time_s":1.4,"mem_mb":13.3,"disk_size":"33M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.22,"mem_mb":13.3,"disk_size":"23.8M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.4,"import_time_s":1.27,"mem_mb":13.3,"disk_size":"24M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.14,"mem_mb":12.7,"disk_size":"23.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.4,"import_time_s":1.15,"mem_mb":12.7,"disk_size":"24M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.76,"mem_mb":10.8,"disk_size":"28.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pykdebugparser","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.7,"import_time_s":0.59,"mem_mb":10.8,"disk_size":"29M"}]}}