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.

Source Distribution

hotreload-2020.6.12.15.23.48.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

hotreload-2020.6.12.15.23.48-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file hotreload-2020.6.12.15.23.48.tar.gz.

File metadata

  • Download URL: hotreload-2020.6.12.15.23.48.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for hotreload-2020.6.12.15.23.48.tar.gz
Algorithm Hash digest
SHA256 4c5fe330221ee60af2506c33593f36b7cfdfe7bbe327438aae86e111857ae555
MD5 563e71cc5d8e380f9fc6a63e6464d2ce
BLAKE2b-256 7d27b7c635740d72a3a3af390fe6f8f4ff5e25e443ea4c87d021cd080f9f78be

See more details on using hashes here.

File details

Details for the file hotreload-2020.6.12.15.23.48-py3-none-any.whl.

File metadata

  • Download URL: hotreload-2020.6.12.15.23.48-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for hotreload-2020.6.12.15.23.48-py3-none-any.whl
Algorithm Hash digest
SHA256 3675e5de541dfe6385c35637036b1d703479a9e690d2de8305b2c1ba8c08ca7a
MD5 88e3221a266491a3d263ef82f02c613a
BLAKE2b-256 e7c912e3ea5ce0e5d598fabd7c6801310af6ea63bbaf14af7b3f76e9cba2b609

See more details on using hashes here.

Supported by

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