Skip to content

Exposing watchfiles settings to the user #174

Open
@cmarqu

Description

@cmarqu

I found that I am getting two Sphinx rebuilds per change saved (with versions of sphinx-autobuild and watchfiles as of today).
Setting WATCHFILES_DEBUG=1, I see

1 change detected: {(<Change.deleted: 3>, 'mytheme.css')}
[Sphinx rebuilds]
1 change detected: {(<Change.added: 1>, 'mytheme.css')}
[Sphinx rebuilds]

It appears to be due to a combination of my editor (Emacs) doing a delete+add for each file save and a slow filesystem (over local network).
I can fix the problem by adding the debounce and step options (https://watchfiles.helpmanual.io/api/watch/#watchfiles.watch) to the watchfiles.awatch call in sphinx_autobuild/server.py and increasing their values:

2 changes detected: {(<Change.deleted: 3>, 'mytheme.css'), (<Change.added: 1>, 'mytheme.css')}
[Sphinx rebuilds]

How could we best expose these settings? Adding extra command line options for such a rare problem might be overkill. Would an environment variable be better?

Coming to think of it, it might even be better to have environment variables for such defaults in watchfiles itself? I'll open an issue there too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions