Wcmatch is a Python library that provides enhanced `fnmatch`, `glob`, and `pathlib` functionalities, closely following Bash-like wildcard and glob matching features. It includes support for recursive globs (`**`), Zsh-style symlink traversal (`***`), brace expansion, extended glob patterns, and more. The library is actively maintained with regular releases, often adding new features and dropping support for older Python versions.
pip install wcmatchVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic recursive globbing, including how to match hidden files, and a simple string match using `fnmatch`. This creates a temporary directory structure for the example.
Upgrade your Python environment to 3.9 or newer.
Review your code for usage of `glob.raw_escape` and remove it, as its functionality is no longer available.
Choose either the `exclude` parameter or the `NEGATE` flag with `!` prefix for exclusion patterns, but not both in the same call. The `exclude` parameter offers a cleaner separation.
Add `flags=glob.GLOBSTAR | glob.FOLLOW` or `flags=glob.GLOBSTARLONG` to your `glob.glob` calls if symlink traversal is desired.
Add `flags=glob.DOTGLOB` (or `glob.GLOBSTAR | glob.DOTGLOB` for recursive hidden files) to your `glob.glob` or `pathlib` calls.
Be mindful of complex brace expansions. Consider using extended glob patterns like `@(a|b|c)` or adjusting the `limit` parameter in `compile` or `glob` functions (set to `0` for no limit) if necessary.
Use raw strings for patterns with backslashes (e.g., `r'C:\Users\**'`) or use forward slashes for cross-platform compatibility.
Import `wcmatch.glob` instead of the standard `glob` module: `from wcmatch import glob` then `glob.glob('**/*.txt', flags=glob.GLOBSTAR)`.Instantiate the `Path` class and call the method on the instance: `from wcmatch.path import Path` then `Path('.').walk()`.Install the library using pip: `pip install wcmatch`.
Upgrade Python to a supported version (e.g., Python 3.9 or newer for recent `wcmatch` versions) or explicitly install an older `wcmatch` version compatible with your current Python (e.g., `pip install wcmatch==7.0.2` for Python 3.7).