{"library":"manhole","title":"Manhole - In-process Python Debugging Shell","description":"Manhole is an in-process Python service that accepts Unix domain socket connections to provide stack traces for all threads and an interactive Python prompt. It can operate as a daemon thread or a signal handler. It is inspired by Twisted's manhole and focuses on simplicity with no external dependencies. The current version is 1.8.1, and releases appear to be on a somewhat irregular, feature-driven cadence.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install manhole"],"cli":{"name":"manhole","version":"sh: 1: manhole: not found"}},"imports":["import manhole\nmanhole.install()","from manhole import handle_connection_repl","from manhole import handle_connection_exec"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import manhole\nimport time\nimport os\nimport sys\n\ndef main():\n    print(f\"Manhole will listen on /tmp/manhole-{os.getpid()}\\n\")\n    manhole.install(sigmask=[\"USR1\"], verbose=True) # Install manhole with default settings\n    print(\"Manhole installed. Waiting for connection...\")\n    \n    # Simulate a running application\n    i = 0\n    while True:\n        print(f\"App running... {i}\")\n        time.sleep(2)\n        i += 1\n        if i == 5: # Optionally demonstrate manual activation/deactivation\n            print(\"Sending USR1 to self to potentially activate/deactivate manhole if configured as 'activate_on'\")\n            try:\n                os.kill(os.getpid(), 10) # SIGUSR1\n            except AttributeError:\n                print(\"SIGUSR1 not available on this OS, skipping manual signal.\")\n\n\nif __name__ == '__main__':\n    import subprocess\n    # Start the application with manhole installed\n    app_process = subprocess.Popen([sys.executable, __file__])\n    time.sleep(3)\n    \n    # Connect to the manhole using manhole-cli\n    print(f\"\\nConnecting to manhole-cli for PID: {app_process.pid}...\")\n    try:\n        # The `manhole-cli` attempts to connect to /tmp/manhole-<PID>\n        # Note: 'socat readline' provides a better interactive experience.\n        # 'manhole-cli' is simpler for demonstration.\n        subprocess.run(['manhole-cli', str(app_process.pid)], check=True)\n    except FileNotFoundError:\n        print(\"manhole-cli not found. Please ensure it's installed and in your PATH.\")\n    except subprocess.CalledProcessError as e:\n        print(f\"manhole-cli failed: {e}\")\n    finally:\n        app_process.terminate()\n        app_process.wait()\n        print(\"\\nApplication terminated.\")\n","lang":"python","description":"This quickstart demonstrates how to install `manhole` in a Python application and then connect to it using the `manhole-cli` tool. The application will print a message indicating the socket path, run in the background, and then `manhole-cli` will be used to establish an interactive session. Inside the manhole, you can inspect variables or execute code. For a richer interactive experience (history, editing), `socat readline unix-connect:/tmp/manhole-PID` is recommended instead of `manhole-cli`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.8.1","pypi_latest":"1.8.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":0.06,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.05,"mem_mb":2,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.04,"mem_mb":2.1,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"manhole","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.2,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.07,"mem_mb":2.2,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":2.2,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.07,"mem_mb":2.2,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"manhole","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.4,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.07,"mem_mb":2.2,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.05,"mem_mb":2,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"manhole","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.05,"mem_mb":2,"disk_size":"18M"}]}}