Package: wutch
Wutchwutchwatches for changes in the directories and runs a shell command for
every change. It can also open a browser a display whatever is in the build
directory, just like Live Server.Common use case for Wutch involves writing docs withSphinx. Wutch will
watch for the changes in all*.rstfiles and automatically rebuild documentation.
It will also open a browser window pointing to the build directory and inject
every built webpage with a code that will auto-refresh that page after each
rebuild.DocumentationGetting Started (Blog post)InstallationpipinstallwutchUsageJust run wutch in the directory where you want to watch for the changes.
By default,wutchwill:Watch for every change in the current directory.Ignore changes in the_build/andbuilddirectories.Runsphinx-buildshell command for every change in the files.Open a browser pointing toindex.htmlin the_builddirectory.Automatically refresh that page every time you change the files
and shell command runs.$wutch-vvv2021-04-1012:33:16.367|DEBUG|wutch.watcher:start:25-Startingobserverthread2021-04-1012:33:16.368|DEBUG|wutch.watcher:on_any_event:58-Processingevent<FileModifiedEvent:event_type=modified,src_path='docs',is_directory=False>.
rm-rf"_build"#@poetry run sphinx-build -M build "." "_build"RunningSphinxv3.5.3
loadingtranslations[en]...donemakingoutputdirectory...donebuilding[mo]:targetsfor0pofilesthatareoutofdate
building[html]:targetsfor1sourcefilesthatareoutofdate
updatingenvironment:[newconfig]1added,0changed,0removed
readingsources...[100%]index
lookingfornow-outdatedfiles...nonefound
picklingenvironment...donecheckingconsistency...donepreparingdocuments...donewritingoutput...[100%]index
generatingindices...genindexdonewritingadditionalpages...searchdonecopyingstaticfiles...donecopyingextrafiles...donedumpingsearchindexinEnglish(code:en)...donedumpingobjectinventory...donebuildsucceeded.

TheHTMLpagesarein_build/html.2021-04-1012:33:17.627|DEBUG|wutch.watcher:on_any_event:71-Shellcommandexecutedwithresult:None.2021-04-1012:33:17.627|DEBUG|wutch.events:report:15-NewEvent.ShellCommandFinishedeventhasbeenreported.2021-04-1012:33:17.627|DEBUG|wutch.watcher:start:28-Observerthredstarted2021-04-1012:33:17.628|DEBUG|wutch.server:start:44-Serverthreadstarted2021-04-1012:33:17.628|DEBUG|wutch.server:open_browser:137-Openingbrowserat:http://localhost:5010/index.htmlStop wutch by issuing aCtrl+Ckey sequence.^C2021-04-1012:33:28.396|DEBUG|wutch.threaded:run:28-StoppingallthreadsonKeyboardInterrupt2021-04-1012:33:28.397|DEBUG|wutch.watcher:stop:32-Stoppingobserverthread2021-04-1012:33:28.560|DEBUG|wutch.watcher:stop:35-Observerthreadstopped2021-04-1012:33:28.560|DEBUG|wutch.server:stop:58-ServerthreadstoppedConfigurationParameters-h,--helpshowthishelpmessageandexit-cCOMMAND,--commandCOMMANDShellcommandexecutedinresponsetofilechanges.Defaultsto:sphinx-build.
-CCONFIG,--configCONFIGPathtothewutchconfigfile.Defaultsto:wutch.cfg.
-d[DIRS...],--dirs[DIRS...]Directoriestowatch(separatedby' ').Defaultsto:['.'].
-p[PATTERNS...],--patterns[PATTERNS...]Matchespathswiththesepatterns(separatedby' ').Defaultsto:['*'].
-P[IGNORE_PATTERNS...],--ignore-patterns[IGNORE_PATTERNS...]Ignoreschangesinfilesthatmatchthesepatterns(separatedby' ').Defaultsto:['_build/','build/'].
-wWAIT,--waitWAITWaitNsecondsafterthecommandisfinishedbeforerefreshingthewebpage.Defaultsto:1.
-bBUILD,--buildBUILDBuilddirectorycontainingfilestorenderinthebrowser.Defaultsto:_build/html.
-I[INJECT_PATTERNS...],--inject-patterns[INJECT_PATTERNS...]PatternsoffilestoinjectwithJScodethatrefreshesthemonrebuild(separatedby' ').Defaultsto:['*.htm*'].
-iINDEX,--indexINDEXFilethatwillbeopenedinthebrowserwiththestartofthewatcher.Defaultsto:index.html.
--hostHOSTHosttobindinternalHTTPserverto.Defaultsto:localhost.
--portPORTTCPporttobindinternalHTTPserverto.Defaultsto:5010.
-B,--no-browserDonotopenbrowseratwutchlaunch.Defaultsto:False.
-S,--no-serverDonotstartthewebserver,justlaunchtheshellcommand.Defaultsto:False.
-v,--verboseLogverbosity.Hasfourlevels:error,wargning,info,anddebug.Canbestacked:-v(forwarning)or-vvv(fordebug).
-V,--versionDisplayversionofthewutch.Loading orderWutch loads configuration settings in the following priority:Command line argumentsEnvironment variables starting withWUTCH_Configuration filewutch.cfgDefault variablesEvery variable can be specified in any of the sources above, thanks toilexconfconfiguration management library.For example,dirsvariable that lists directories to watch can be
specified in several ways:Command line:wutch--dirs.../other_dirEnvironment variables starting withWUTCH_:exportWUTCH_DIRS=". ../other_dir"Configuration filewutch.cfg:{"dirs":[".","../other_dir"]}Wutch's documentation is built usingwutchTake a look at thewutch.cfgfile at the root of the repository. This
serves as a somewhat common configuration for Sphinx dependent documentation.Wutch documentation is developed usingwutchand this config below.{"dirs":["docs"],"patterns":["*.rst","*.py"],"ignore_patterns":["docs/_build/"],"command":"make -C docs rebuild","build":"docs/_build/html","inject_patterns":["*.html"],"index":"index.html","host":"localhost","port":5010}