Trigger custom commands from filesystem events.
Trigger methods from changed files - e.g. selectively rebuild your project or run tests as soon as you hit the save button on your text editor or IDE.
Patrol works well with ProjectKey.
pip install patrol
import patrol def build(filenames): touch("output/build_started") time.sleep(2) touch("output/build_finished") def run_test(filenames): touch("output/test_started") time.sleep(30) touch("output/test_finished") patrol.watch([ patrol.Trigger( build, includes=["data/*", ], excludes=['data/exclude/*', 'output/*', ], ), patrol.Trigger( run_test, includes=["data/*", ], excludes=['data/exclude/*', 'output/*', ], reaper=patrol.Reaper(), # If triggered while method is in progress, this will stop it and start it again. fire_on_initialization=True, # When the watch is initiated, this trigger will also fire. ), ], directory=os.getcwd(), # By default it patrols the present working directory. lockfiles=[".git/index.lock", ], # This will wait until git has finished its operations before firing any triggers )