fix #3431: Change autoreload behavior to work correctly with Unix shell wildcards

The default `IGNORE_FILES` value of `'.*'` was being compiled to a regular expression and then passed into `watchfiles.DefaultFilter` to filter out files when autoreload is enabled.

This commit compares the patterns from `IGNORE_FILES` directly with the filename to match the usage of `fnmatch` elsewhere in the codebase. The new filtering class will continue working as expected for custom `IGNORE_FILES` settings.
This commit is contained in:
Yashas Lokesh 2025-01-02 00:55:25 -05:00
commit c444c88b18
No known key found for this signature in database
5 changed files with 99 additions and 9 deletions

View file

@ -150,13 +150,17 @@ Basic settings
READERS = {'foo': FooReader}
.. data:: IGNORE_FILES = ['.*']
.. data:: IGNORE_FILES = ['**/.*']
A list of glob patterns. Files and directories matching any of these patterns
will be ignored by the processor. For example, the default ``['.*']`` will
A list of Unix glob patterns. Files and directories matching any of these patterns
or any of the commonly hidden files and directories set by ``watchfiles.DefaultFilter``
will be ignored by the processor. For example, the default ``['**/.*']`` will
ignore "hidden" files and directories, and ``['__pycache__']`` would ignore
Python 3's bytecode caches.
For a full list of the commonly hidden files set by ``watchfiles.DefaultFilter``,
please refer to the `watchfiles documentation`_.
.. data:: MARKDOWN = {...}
Extra configuration settings for the Markdown processor. Refer to the Python
@ -1416,3 +1420,4 @@ Example settings
.. _Jinja Environment documentation: https://jinja.palletsprojects.com/en/latest/api/#jinja2.Environment
.. _Docutils Configuration: http://docutils.sourceforge.net/docs/user/config.html
.. _`watchfiles documentation`: https://watchfiles.helpmanual.io/api/filters/#watchfiles.DefaultFilter.ignore_dirs