Skip to main content

Run any arbitrary python script every time the code changes in the file.

Project description

hotreload: hot reload your python code!
hotreload.py
hot reload your python code!

Run any arbitrary python script every time the code changes in the file.

installation

Get the package from PyPI with pip3 install hotreload.

usage

Say you have script (script.py) that you want to run every time the code changes in that file.

To do that, it is as simple as doing this:

import time
import logging
from hotreload import Loader


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    script = Loader("script.py")

    while True:
        # Check if script has been modified since last poll.
        if script.has_changed():
            # Execute a function from script if it has been modified.
            script.main()

        time.sleep(1)

author

Sayan Goswami © 2020

Project details


Download files

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

Files for hotreload, version 2020.6.12.15.23.48
Filename, size File type Python version Upload date Hashes
Filename, size hotreload-2020.6.12.15.23.48-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hotreload-2020.6.12.15.23.48.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page