bug(reload exclude): Allow for subdirectories to be excluded #2602
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for uvicorn! I'm a dev currently working on https://github.com/posit-dev/py-shiny. When running our app, we can create nested folders (whose ancestor is the current working directory, which is always watched) that we'd like to exclude when reloading is enabled. We do know the ancestor folder name that should be excluded, but we do not know know the finalized paths at initialization time.
It would be great if we could be able to exclude exact matches an ancestor folder. Ex:
__pycache__
within any subdirectory.This stems from discussion in #2526 (comment)
Summary
Bugs fixed:
config.reload_dirs
) are absolute, so the path parents are also absolute.FileFilter
should also be absolute paths.--reload-exclude '__pycache__'
only excludes the__pycache__
directory in the current working directory. However, it'd be nice to exclude all__pycache__
directories if they're anywhere within areload_dir
.set()
s to clearly show the goal of the content for the final list. This reduces the object's construction to a single location.Documentation updates:
**
can not be used as a pattern for--reload-include
and--reload-exclude
.Checklist
Future:
FileFilter
's.exclude_dirs
logic be moved to become runtime match logic to directory structures that change after initialization.