Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-reloader

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-reloader

file-reloader allows user program to reload automatically when source code of user program changes

  • 1.0.5
  • PyPI
  • Socket score

Maintainers
1

file_reloader Library

The file_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.

Installation

pip install file-reloader

Usage

  1. Import the file_reloader module from the Reloader library.

    from file_reloader import Reloader
    
  2. Create an instance of the Reloader class.

    my_reloader = Reloader()
    
  3. 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 file_reloader

# Your program code goes here...

my_reloader = file_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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc