Metadata-Version: 2.5
Name: nosleep-py
Version: 0.1.0
Summary: Zero-overhead native Windows sleep and screen lock prevention utility and library.
Project-URL: Homepage, https://github.com/Adi-CodeHub/nosleep-py
Project-URL: Repository, https://github.com/Adi-CodeHub/nosleep-py
Author-email: Aditya Sharma <adityasharma@example.com>
License: MIT
Keywords: awake,caffeine,keep-awake,nosleep,sleep-prevention,windows
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# ⚡ nosleep-py

A zero-overhead, native Windows sleep and screen-lock prevention library and CLI tool.

No fake mouse movement. No CPU usage. Zero dependencies. Directly leverages Windows Kernel execution state flags (`SetThreadExecutionState`).

---

## 📦 Installation

```bash
pip install nosleep-py
```
Or with `uv`:
```bash
uv add nosleep-py
```

---

## 🚀 Python Library Usage

### 1. Context Manager (Recommended)
Automatically protects a block of code from system sleep, and safely restores normal behavior when finished (even if an exception occurs):

```python
import time
from nosleep_py import keep_awake

# Keep system and screen awake during training/rendering
with keep_awake():
    print("Doing 2-hour heavy processing...")
    time.sleep(7200)

# Back to normal automatically!
```

### 2. Manual Controls
```python
import nosleep_py

# Turn ON sleep prevention
nosleep_py.prevent_sleep(keep_display=True)

# ... Do your long-running tasks ...

# Turn OFF sleep prevention
nosleep_py.allow_sleep()
```

### 3. CPU Awake Only (Allow Screen/Display to Turn Off)
```python
with keep_awake(keep_display=False):
    # Perfect for background downloads or overnight batch processing
    download_large_dataset()
```

---

## 💻 CLI Terminal Usage

Once installed, you can run `nosleep` directly from any terminal:

```bash
# Keep awake indefinitely (Press Ctrl+C to stop)
nosleep

# Keep awake for 30 minutes, then auto-stop
nosleep --minutes 30

# Keep CPU awake only (allow monitor to turn off)
nosleep --minutes 60 --no-display
```

---

## 🛡️ License
MIT License. Free for personal and commercial use.
