file-reloader allows user program to reload automatically when source code of user program changes
Project description
AutoReload Library
The Reloader library provides a convenient way for users to automatically reload their Python programs whenever the source code changes. This can be particularly useful during development and testing phases.
Usage
-
Import the
reloader
module from the Reloader library.from reloader import Reloader
-
Create an instance of the
Reloader
class.my_reloader = Reloader()
-
Add the following code at the end of your program to enable automatic reloading.
my_reloader.reloader()
Parameters
- file_path (str): Absolute path of the file (default is
sys.argv[0]
). - args (List[str]): Extra arguments required for the program (default is
None
). - reload_time (int): Expected amount of time after which the reloader checks for updates (default is
5 sec
).
Now, whenever you make changes to your source code and save the file, the program will automatically reload without the need to restart it manually.
Example
# your_program.py
import reloader
# Your program code goes here...
my_reloader = reloader.Reloader()
my_reloader.reloader()
Important Note
Ensure that you place the reloader()
call at the end of your program to avoid any interference with the rest of your code.
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
File details
Details for the file file-reloader-1.0.4.tar.gz
.
File metadata
- Download URL: file-reloader-1.0.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd137801e78db242e1c5f803107a9cfe2521722d93bba202ee6af40a7fd2449c |
|
MD5 | 0b151e4cb8ed68aaf83ed398809f6b3c |
|
BLAKE2b-256 | 685e41c2cd1ff56df31fc49329ccfa01f91e82e8437117de825c265844da9319 |