Universal Hot-Reload Manager
Project description
Flux
Universal Hot-Reload Manager
Flux is a cross-platform, language-agnostic CLI tool that watches your code and automatically restarts any shell command when files change. It ships with zero-config defaults, optional TOML/YAML configuration, and a Rich-powered TUI for live logs and timing.
🚀 Features
- Universal watcher: wrap any command (servers, test runners, compilers, file sync, etc.)
- Zero-config: sensible defaults (watch
./, ignore.git/,venv/,node_modules/, all extensions, 200 ms debounce) - Config file support:
hotreload.tomlorhotreload.yamlfor persistent settings - Flexible CLI flags: override paths, ignore patterns, extensions, debounce interval, and command
- Debounced restarts: coalesce rapid file changes into a single restart
- Cross-platform: Linux (inotify), macOS (FSEvents), Windows (ReadDirectoryChangesW)
- Rich TUI: color-coded stdout vs stderr, process status indicator, and runtime timer
💾 Installation
From PyPI (soon):
pip install flux
From source (editable mode):
git clone https://github.com/yourusername/flux.git
cd flux
pip install -e .
⚡ Quick Start
Wrap your existing command:
flux -- python server.py --port 8080
Flux will watch the current directory (.), ignore common folders, and restart your process whenever any file changes, showing logs and restart timings in its built-in TUI.
📖 CLI Usage
Usage: flux [OPTIONS] -- <command>...
Options:
-w, --watch PATH Paths to watch (repeatable)
-i, --ignore PATH Paths to ignore (repeatable)
--exts TEXT Comma-separated extensions (e.g. py,html)
--debounce INT Debounce interval in milliseconds (default: 200)
-c, --config PATH Path to hotreload.toml or .yaml
--help Show this message and exit
Examples
# Watch src/ and templates/, ignore tests/
flux -w src -w templates -i tests -- python app.py
# Only trigger on .py and .html changes
flux --exts py,html -- python app.py
# Increase debounce to 500 ms
flux --debounce 500 -- python app.py
# Using a config file
flux -c hotreload.toml
⚙️ Configuration File
Drop a hotreload.toml or hotreload.yaml in your project root:
# hotreload.toml
watch = ["src/", "templates/"]
ignore = ["tests/", "venv/"]
exts = ["py", "html"]
debounce_ms = 300
cmd = ["python", "app.py", "--port", "8080"]
# hotreload.yaml
watch:
- src/
- templates/
ignore:
- tests/
- venv/
exts:
- py
- html
debounce_ms: 300
cmd:
- python
- app.py
- --port
- "8080"
Then simply:
flux -c hotreload.toml
Flux will pick up all your settings and run your command with automatic reloads.
🏗 Architecture Overview
Flux is built as an async event-driven pipeline:
- Watcher
Useswatchdogto observe filesystem changes and pushes events into anasyncio.Queue. - Debouncer
Coalesces rapid bursts of events into a singleReloadSignal. - Process Manager
Gracefully kills & restarts your wrapped command viaasyncio.create_subprocess_exec. - Renderer
Renders a Rich TUI: color-coded logs, ▶️/⏸ status icon, and restart timers.
Each stage is decoupled by queues, adheres to SOLID principles, and is easy to unit-test or extend.
🤝 Contributing
- Fork the repo
- Create a feature branch:
git checkout -b feat/my-feature
- Commit your changes & add tests
- Open a Pull Request
Please follow the existing code style, write tests for new features, and ensure the TUI remains responsive.
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 flux_reload-0.1.0.tar.gz.
File metadata
- Download URL: flux_reload-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17dbea5197b977ed26182aae85f82065d54905f793db75339f6aa9460e636b48
|
|
| MD5 |
80fad5ed2ce69df2fb28eda71971d001
|
|
| BLAKE2b-256 |
e8ea33cb8df245e3b94feed32601df713eeb4ecbdb3a1af5c5df448d0d183671
|
File details
Details for the file flux_reload-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flux_reload-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb83bf682fcaebe6340e58c71428ba4c91e70f86d8b74056925c2c8dbb7806ac
|
|
| MD5 |
c741ab65e8b637fb350b3d0805b807ee
|
|
| BLAKE2b-256 |
7288a6f135979ba9da69f736d8d844f1a94753bf9e4236507a8fe7348496e591
|