Metadata-Version: 2.4
Name: run-on-save
Version: 0.1.0
Summary: Auto-run Python files on save
License: MIT
Requires-Python: >=3.13
Requires-Dist: watchdog>=6.0.0
Description-Content-Type: text/markdown

# run-on-save

Automatically runs a Python file whenever it's saved. Useful for quick feedback loops during development.

## Installation

```sh
uv tool install run-on-save
```

## Usage

Run from your project directory:

```sh
run-on-save
```

Whenever you save a `.py` file, it will be executed automatically in the terminal.

## Features

- 🔍 Watches the entire project directory recursively
- ⚡ Cooldown period to avoid duplicate runs on rapid saves
- 🧹 Clears the terminal before each run
- 🚫 Ignores common non-source directories (`.venv`, `__pycache__`, `.git`, `node_modules`, etc.)
- 🔢 Runs files in unbuffered mode (`-u`) so output appears immediately

## Configuration

Edit the constants at the top of the source to adjust behaviour:

| Constant | Default | Description |
|---|---|---|
| `CLEAR_EACH_RUN` | `True` | Clear terminal before each run |
| `COOLDOWN_SECONDS` | `0.4` | Minimum seconds between runs of the same file |

## Ignored Directories

The following directories are ignored by default:

`.git`, `.venv`, `venv`, `env`, `__pycache__`, `.mypy_cache`, `.pytest_cache`,
`node_modules`, `dist`, `build`, `.tox`, `.nox`, `.idea`, `.vscode`, `.zed`, and more.

## Requirements

- Python 3.13+
- [watchdog](https://pypi.org/project/watchdog/)

## License

MIT
