--- id: wakepy version: "1.0.0" license: MIT License Copyright (c) 2021-2024 Niko Föhr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) license_treatment: permissive maintenance: active --- # wakepy — wakelock / keep-awake / stay-awake License: permissive · Maintenance: active · Downloads: 168.1K/mo ## What it is and what it does Wakepy is a cross-platform Python library and CLI tool that prevents your system from automatically sleeping, suspending, or locking the screen during long-running tasks. It works on Windows (via SetThreadExecutionState), macOS (via caffeinate), and Linux/Unix systems with GNOME, KDE Plasma, or Freedesktop.org desktop environments. The package offers two main modes: keep.running inhibits sleep and suspend but allows screen lock and screensaver, while keep.presenting also keeps the display active and prevents screen lock. You use it either as a decorator or context manager around your code, or invoke it from the command line. It's designed to be non-disruptive—it uses only the system APIs provided for this purpose, never simulates keyboard or mouse input—and safe to crash; killing the process leaves no lingering state. The package has minimal dependencies: on Linux it requires jeepney for D-Bus communication, and on Python 3.9 and earlier it needs typing-extensions; otherwise it has no Python dependencies. Use it for: - Training machine learning models or running long data-processing pipelines that must not be interrupted by system sleep - Video encoding, transcoding, or upscaling tasks that require the system to stay awake for hours - Displaying dashboards, monitoring applications, or videos that require the screen to remain on and unlocked - Web scraping or data archival operations that run unattended overnight or over many hours - Automated hardware control or instrumentation tasks (e.g., knitting machines, scientific instruments) that must complete without interruption ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Wakepy prevents a system from sleeping or locking the screen during long-running tasks, with separate modes for keeping the CPU awake or keeping the display active. Yes. Wakepy is actively maintained, has zero known vulnerabilities, minimal dependencies, and a permissive MIT license. It solves a real cross-platform problem using proper system APIs rather than hacks. Install it if you need to prevent sleep or lock during long tasks. ## Install pip install wakepy uv add wakepy poetry add wakepy ## Installing wakepy Before you install: Low friction: pure Python wheel with only two runtime dependencies (jeepney and typing-extensions), both lightweight. Active maintenance with recent releases; last commit 2026-04-01. License in practice: MIT License (permissive) — you can use, modify, and distribute wakepy freely in commercial and private projects with minimal restrictions. Quickstart: pip install wakepy from wakepy import keep @keep.running def long_task(): # Your long-running code here pass Verify before relying: - Whether the package works reliably across all listed Unix desktop environments without additional system configuration - Performance overhead when running keep.running or keep.presenting modes over extended periods ## Package facts - License: MIT License Copyright (c) 2021-2024 Niko Föhr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 168.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags prevent system sleep, keep screen awake, wakelock python, inhibit suspend, stay-awake cross-platform, system sleep prevention, keep cpu running, system-control, cross-platform, task-automation [View on SkillFed](https://skillfed.io/packages/wakepy) · [View on PyPI](https://pypi.org/project/wakepy/)