Auto-run Python files on save
Project description
run-on-save
Automatically runs a Python file whenever it's saved. Useful for quick feedback loops during development.
Installation
uv tool install run-on-save
Usage
Run from your project directory:
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
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file run_on_save-0.1.0.tar.gz.
File metadata
- Download URL: run_on_save-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c9ac4723bd930dd17f093502f31107f66dd91df6265f1814f5cd43de78ae62e
|
|
| MD5 |
1f29396177657de0ef8a41f329031ece
|
|
| BLAKE2b-256 |
bab1865f9600e0c03050ab35612bf13e88d88b1ec33377cceb909c48855d712b
|
File details
Details for the file run_on_save-0.1.0-py3-none-any.whl.
File metadata
- Download URL: run_on_save-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c828d485896a59f19d3cc028cdfcffa30e452d796171748aafe6760fb033b657
|
|
| MD5 |
f9040eb4a5890f360650f0978db75c82
|
|
| BLAKE2b-256 |
be31de977fdef2e8d8b7d8638d7727a4be304fa58086ad5fafcac076f77dc10a
|