Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor Python files for changes?

I want to restart my Python web application, if code gets changed. But there could be a large number of files that could be changed, since files in imported modules could change ...

How to get the actual file names from imported packages / modules?

How can modified Python files be detected efficiently? Is there a library to do that?

like image 486
deamon Avatar asked Feb 26 '23 03:02

deamon


2 Answers

Shameless plug. There's also http://github.com/gorakhargosh/watchdog that I'm working on to do exactly this.

HTH.

like image 50
GoraKhargosh Avatar answered Mar 08 '23 05:03

GoraKhargosh


gamin is another option which is slightly less Linux-specific.

like image 30
Ignacio Vazquez-Abrams Avatar answered Mar 08 '23 06:03

Ignacio Vazquez-Abrams