{"id":1332,"library":"appnope","title":"Appnope","description":"Appnope is a small Python library for macOS (10.9 and later) that disables App Nap for the current process. It is primarily used in long-running Python applications and interactive environments like Jupyter notebooks to prevent them from being suspended when in the background. The current version is 0.1.4, and the library is in maintenance, receiving updates mainly for compatibility.","status":"maintenance","version":"0.1.4","language":"en","source_language":"en","source_url":"https://github.com/minrk/appnope","tags":["macos","app nap","jupyter","performance","system utility"],"install":[{"cmd":"pip install appnope","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary way to use appnope; importing it automatically disables App Nap for the current process.","symbol":"appnope","correct":"import appnope"},{"note":"Used to explicitly toggle App Nap status after initial import, or if you wish to re-enable it.","symbol":"set_appnap_enabled","correct":"import appnope\nappnope.set_appnap_enabled(False)"}],"quickstart":{"code":"import appnope\nimport time\n\nprint(\"App Nap is now disabled for this process (macOS 10.9+).\")\nprint(\"Sleeping for 10 seconds. Check activity monitor if App Nap usually affects this process.\")\n\ntime.sleep(10)\n\n# To explicitly re-enable or disable App Nap later:\n# appnope.set_appnap_enabled(True) # Re-enable App Nap\n# appnope.set_appnap_enabled(False) # Disable App Nap again\n\nprint(\"Done. App Nap status remains as last set.\")","lang":"python","description":"The simplest way to use appnope is to import it. This will automatically disable App Nap for the current Python process on supported macOS versions. For more granular control, `set_appnap_enabled()` can be used."},"warnings":[{"fix":"Ensure your environment is macOS (version 10.9 or later) when using appnope. It's advisable to guard its import with platform checks if your code needs to run on multiple OSes (e.g., `if sys.platform == 'darwin': import appnope`).","message":"Appnope is a macOS-specific library. It will not have any effect or may raise platform-specific errors if run on non-macOS operating systems.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware of the target macOS version. The library's utility is limited to macOS 10.9+.","message":"App Nap itself only exists on macOS 10.9 (Mavericks) and later. Using `appnope` on older macOS versions will have no effect related to App Nap, though the library might still import.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If child processes also need App Nap disabled, you must import `appnope` within those child processes' entry points or apply equivalent OS-level settings.","message":"Appnope disables App Nap only for the *current* process. If your Python application spawns child processes (e.g., using `subprocess` or `multiprocessing`), those child processes will not automatically inherit the App Nap disabled state and may still be subject to App Nap.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Simply placing `import appnope` at the beginning of your script or interactive session is sufficient to disable App Nap for that process.","message":"The primary effect of `appnope` occurs immediately upon `import appnope`. It's not a function call that you explicitly make after import (unless you use `set_appnap_enabled`).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}