{"library":"simpervisor","title":"Simpervisor: Simple Async Process Supervisor","description":"Simpervisor is a lightweight Python library providing an asynchronous process supervisor. It offers the `SupervisedProcess` class to manage external processes with async methods like `start`, `ready`, `terminate`, and `kill`. The library is actively maintained, with its latest major release (1.0.0) in May 2023, indicating a stable but less frequent release cadence focused on robustness.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install simpervisor"],"cli":null},"imports":["from simpervisor import SupervisedProcess"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import asyncio\nimport sys\nimport os\nfrom simpervisor import SupervisedProcess\n\n# Create a dummy script to supervise\ndummy_script_content = \"\"\"\nimport asyncio\nimport sys\nimport time\n\nasync def child_process_task():\n    print(f\"Child process {os.getpid()} started.\")\n    try:\n        for i in range(5):\n            print(f\"Child process {os.getpid()}: Working... {i+1}/5\")\n            await asyncio.sleep(1)\n        print(f\"Child process {os.getpid()}: Done working, exiting.\")\n    except asyncio.CancelledError:\n        print(f\"Child process {os.getpid()}: Cancelled, cleaning up.\")\n    except Exception as e:\n        print(f\"Child process {os.getpid()}: Error - {e}\")\n    finally:\n        print(f\"Child process {os.getpid()} exiting gracefully.\")\n\nif __name__ == '__main__':\n    asyncio.run(child_process_task())\n\"\"\"\n\nasync def main():\n    script_path = \"./dummy_child_script.py\"\n    with open(script_path, \"w\") as f:\n        f.write(dummy_script_content)\n\n    print(\"Starting supervisor example...\")\n\n    # Supervise the dummy script using python as the executable\n    # This assumes 'python' is in your PATH\n    process = SupervisedProcess(\n        [sys.executable, script_path], # Command to run the child process\n        always_restart=False # For this example, don't restart automatically\n    )\n\n    await process.start()\n    print(f\"Supervisor: Process started with PID {process.pid}\")\n\n    await asyncio.sleep(2) # Give child some time to work\n\n    if await process.ready():\n        print(\"Supervisor: Child process reports ready (or has started).\")\n    else:\n        print(\"Supervisor: Child process not yet ready.\")\n\n    await asyncio.sleep(3)\n\n    print(\"Supervisor: Attempting to terminate child process...\")\n    await process.terminate()\n    # await process.wait() # Can wait for termination if needed\n\n    if not process.running:\n        print(\"Supervisor: Child process terminated.\")\n    else:\n        print(\"Supervisor: Child process is still running after terminate attempt.\")\n\n    os.remove(script_path)\n    print(\"Supervisor: Example finished.\")\n\nif __name__ == '__main__':\n    asyncio.run(main())\n","lang":"python","description":"This example demonstrates how to use `SupervisedProcess` to start an asynchronous Python script as a child process, monitor its status with `ready()`, and gracefully terminate it using `terminate()`. The child process simulates some work before exiting or being cancelled. The `sys.executable` is used to ensure the same Python interpreter runs the child script.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"1.0.0","pypi_latest":"1.0.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":0.2,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.09,"mem_mb":4,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"simpervisor","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":4,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.16,"mem_mb":4.9,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.5,"import_time_s":0.13,"mem_mb":4.9,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.35,"mem_mb":8.2,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.33,"mem_mb":8.2,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.37,"mem_mb":8.7,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.4,"import_time_s":0.33,"mem_mb":8.7,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.08,"mem_mb":3.9,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"simpervisor","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.07,"mem_mb":3.9,"disk_size":"18M"}]}}