Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

say4n/hotreload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

15 Commits

Repository files navigation

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.

warning

You shouldn't do this and this can have unexpected, unintended repurcusions. Proceed with caution, you have been warned!

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

About

hot reload your python code!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /