samuelcolvin / watchfiles

Simple, modern and fast file watching and code reload in Python.
https://watchfiles.helpmanual.io
MIT License
1.75k stars 108 forks source link

Getting more default values from environment variables #302

Open cmarqu opened 2 months ago

cmarqu commented 2 months ago

I have a need to tweak the settings of debounce and step. I am not using watchfiles directly however but via sphinx-autobuild, which does not currently expose those arguments to the user (see https://github.com/sphinx-doc/sphinx-autobuild/issues/174).

I am wondering if it would be a good idea to be able to define the default values of such settings via environment variables so that not all of the tools using watchfiles need to support setting such rarely changed values? One could claim that there even is precedent for this in the form of the existing WATCHFILES_DEBUG.

joelpelaez commented 1 month ago

I think this is important, in Windows platform when running Docker containers for development, WSL doesn't have support for inotify, and many watchers use stat for file monitoring.

Watchfiles has an stat mechanism, but the option for increase poll time between iterations only can be modified on watch() parameters and libraries than use this library don't pass that argument.

Add an environment variables for settings like that can help to optimize or reduce load.