This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.2.0 instead.
Reason given by maintainers: Too old
Keep Awake
Keep your system on and screen on, it will not fall asleep. It is useful in some long term calculations.
How to use?
pip install keep_awake==1.0.2
This module exposes only two methods: prevent_sleep and allow_sleep, both of them taks no arguments.
prevent_sleep returns a boolean value that indicates whether the operation is successful. After you call this method, your system and screen will keep working until you invoke allow_sleep.
You won't have any exceptions by calling any methods twice, or calling allow_sleep without calling prevent_sleep, they have built-in protection.
If you forget to call allow_sleep before exiting your program, it doesn't matter, it will back to usual once the module is released.
Supported platforms
macOS✅
Both arm64 and x64 are OK, this code only depends on IOKit and CoreFoundation, which is built-in macOS Framework.
Methods on macOS are concurrent safe.
Windows✅
We didn't test widely on various versions of Windows because I have no Windows computer :(
But basically, it can work fine on Windows 10 x64 and Windows 11 x64. I have already tested.
Keeping system awake on Windows needs a dedicated thread to loop periodically, so it is hard to perform concurrent-control. Do NOT try any race condition on Windows!
Linux❌
Planning to do, but Linux distros are very complicated, we are still finding some way to implement.
Building & Debugging
We use uv to manage the project, so it is very easy to build and test it.
For building:
uv build
For testing
uv run pytest
Release files for keep-awake 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| keep_awake-1.0.2.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keep_awake-1.0.2-cp314-cp314-macosx_26_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 26.0+ ARM64 | Details |
Total release size: 13.1 kB
Release files / keep_awake-1.0.2.tar.gz
| Download URL | keep_awake-1.0.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
769ec41d3634d540ad619973c20ec40da93860e38fcb7c27a2afe0a6a9ea7842
|
|
BLAKE2b-256 checksum How to use checksums |
07dbdeacaf53c365a9d8d0fc95a0f07fb1e724176b53c39610d2cfbc1935fcf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.4
|
Release files / keep_awake-1.0.2-cp314-cp314-macosx_26_0_arm64.whl
| Download URL | keep_awake-1.0.2-cp314-cp314-macosx_26_0_arm64.whl |
|---|---|
| Size | 6.8 kB |
| Tags | CPython 3.14 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
200a9e8d7e60ca26ae5b8ca8a0a43ed0d17e941b3ccdcd827804a8bcff5a82d7
|
|
BLAKE2b-256 checksum How to use checksums |
6288ef1ac106b67363adb500484892615d63fb77258d6f4ea7231ecbe4ab2d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.4
|