Skip to main content

A Python library for live reloading scripts on file changes.

Project description

🚀 auto-auto-live-reload

PyPI version Python 3.8+ License: MIT

A lightweight Python utility that watches your project for source changes and automatically restarts the current process.

Perfect for speeding up local development of CLIs, scripts, and small services.


📚 Table of Contents


✨ Features

  • 🔍 Watches files matching customizable glob patterns (defaults to *.py).
  • 🚫 Optional exclusion patterns keep temporary or generated files out of the watch list.
  • 🗂️ Recursive directory walking with the ability to opt out for flat projects.
  • ⏱️ Configurable polling interval and initial delay to fit your workload.
  • 🗒️ Verbose logging to understand which files triggered a restart.
  • 🧵 Runs the watcher on a daemon thread so your application code can proceed normally.

📦 Installation

pip install auto-live-reload
# Version: 1.0.1

Or, for local development:

pip install -e .

⚡ Quick Start

Call start_auto_live_reload() as early as possible in your entry point (version 1.0.1):

from auto_live_reload import start_auto_live_reload

start_auto_live_reload()

def main():
    print("Running business logic…")
    # ...

if __name__ == "__main__":
    main()

Any changes to watched files will restart your script automatically.

⚙️ Configuration

You can customize the behavior using arguments:

start_auto_live_reload(
    patterns=["*.py", "*.jinja"],
    delay=1,
)
  • patterns: List of file patterns to watch (default: ['*.py']).
  • delay: Initial delay before watching starts (default: 2).

🖥️ Command-line Helper

A thin CLI wrapper is exposed through auto_live_reload.main(). You can wire it into your own console script entry point or invoke it manually during development:

python -c "import auto_live_reload; auto_live_reload.main()" --interval 2 --patterns "*.py" "*.md"

The available flags mirror the keyword arguments listed above:

  • --patterns, --exclude, --interval, --delay, --no-recursive, and --verbose

The CLI keeps the current process alive, making it ideal for quickly testing live reload behaviour without modifying your application code.

🛠️ Development

  1. Clone the repository and install dependencies in editable mode:
    pip install -e .
    
  2. Run your application or sample script with start_auto_live_reload() enabled.
  3. Make code changes and confirm that the process restarts automatically.

📄 License

This project is licensed under the MIT License.


🙌 Issues and pull requests are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_live_reload-1.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_live_reload-1.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file auto_live_reload-1.0.2.tar.gz.

File metadata

  • Download URL: auto_live_reload-1.0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for auto_live_reload-1.0.2.tar.gz
Algorithm Hash digest
SHA256 088461e86935ef69fae13a8ab9118003c6bfcb58c1e80bc7a673deda85eea7e8
MD5 f63b1b5336ca0f14a99c76d22482cfeb
BLAKE2b-256 7202f23df37bafd6d5a86dbda8b79e77ff9edd3a59cf8144fb5edde932c9dc67

See more details on using hashes here.

File details

Details for the file auto_live_reload-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_live_reload-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26d04c62a2f45629f88af72a22485c618e620b0c294ff66a9140559c7effb0fd
MD5 177f21f5a11d7ae605275789600bd619
BLAKE2b-256 668e592f898df816ca6eb56b1005e7285931031fbf9a8c831e911e579de937c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page