Registry / serialization / wcmatch

wcmatch

JSON →
library11.0.1pypypi✓ verified 26d ago

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 wcmatch
INSTALL
IMPORT
SIG · WCMATCH
W
wcmatch
serializationpythonv11.0.1
Install
1.6s avg
Import
54ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v11.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.056s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.052s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

glob
from wcmatch import glob
For filesystem globbing and path matching.
fnmatch
from wcmatch import fnmatch
For string-based pattern matching.
pathlib
from wcmatch import pathlib
Provides enhanced `pathlib.Path` subclasses with wcmatch's glob behavior.
WcMatch
from wcmatch import wcmatch
The `wcmatch` submodule contains the `WcMatch` class for extendable file searches.

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.

import os import shutil from wcmatch import glob, fnmatch # Create some dummy files/directories for the example os.makedirs('temp_dir/nested/.hidden', exist_ok=True) with open('temp_dir/file.txt', 'w') as f: f.write('hi') with open('temp_dir/nested/another.log', 'w') as f: f.write('hi') with open('temp_dir/nested/.hidden/secret.dat', 'w') as f: f.write('hi') print("Basic recursive glob (glob.GLOBSTAR):") # By default, doesn't match hidden files or symlinks # Output may vary based on OS and actual symlinks results_globstar = glob.glob('temp_dir/**/*.txt', flags=glob.GLOBSTAR) print(f"Found: {sorted(results_globstar)}") # Expected: ['temp_dir/file.txt'] print("\nRecursive glob including hidden files (GLOBSTAR | DOTGLOB):") results_hidden = glob.glob('temp_dir/**/*', flags=glob.GLOBSTAR | glob.DOTGLOB) print(f"Found: {sorted(results_hidden)}") # Expected: Should include 'temp_dir/.hidden/secret.dat', 'temp_dir/file.txt', 'temp_dir/nested/another.log', etc. print("\nString matching with fnmatch:") match_str = fnmatch.fnmatch('image.jpeg', '*.jp*g') print(f"'image.jpeg' matches '*.jp*g': {match_str}") # Expected: True # Clean up shutil.rmtree('temp_dir')
Debug
Known issues
breakingWcmatch has progressively dropped support for older Python versions. Version 10.1 dropped Python 3.8, Version 8.5 dropped Python 3.7, and Version 8.4 dropped Python 3.6. Ensure your environment uses Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or newer.
affects: 8.4, 8.5, 10.1
breakingThe `glob.raw_escape` function was removed in version 9.0.
fix
Review your code for usage of `glob.raw_escape` and remove it, as its functionality is no longer available.
affects: 9.0+
gotchaWhen using `glob` or `fnmatch` for exclusion, the `exclude` parameter (introduced in v8.4) is generally preferred over using the `NEGATE` flag with `!` prefixes in patterns. Do not use both simultaneously, as this can lead to unexpected behavior.
fix
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.
affects: 8.4+
gotchaBy default, `GLOBSTAR` (`**`) in `wcmatch.glob` does not traverse symlinks. To include symlinks in recursive globbing, you must explicitly enable the `FOLLOW` or `GLOBSTARLONG` flag (the latter provides Zsh-style `***` behavior, introduced in 10.0).
fix
Add `flags=glob.GLOBSTAR | glob.FOLLOW` or `flags=glob.GLOBSTARLONG` to your `glob.glob` calls if symlink traversal is desired.
affects: 10.0+
gotchaWildcard characters like `*` do not match files or directories starting with a dot (`.`) by default. To include hidden files/directories in your glob results, enable the `DOTGLOB` flag.
fix
Add `flags=glob.DOTGLOB` (or `glob.GLOBSTAR | glob.DOTGLOB` for recursive hidden files) to your `glob.glob` or `pathlib` calls.
affects: All versions
gotchaLarge brace expansion patterns (e.g., `a{1..100000}`) can lead to a significant number of generated patterns, potentially impacting performance or exceeding the default pattern limit (1000).
fix
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.
affects: 6.0+
gotchaOn Windows, backslashes in patterns must be escaped (e.g., `r'path\\to\file'`) to match literal backslashes, as `wcmatch` allows escaped characters. Forward slashes (`/`) are normalized and will match both forward and backslashes.
fix
Use raw strings for patterns with backslashes (e.g., `r'C:\Users\**'`) or use forward slashes for cross-platform compatibility.
affects: All versions
Errors
Common errors & fixes
TypeError: glob.glob() got an unexpected keyword argument 'flags'
The user imported Python's standard `glob` module but attempted to use `wcmatch`-specific arguments like `flags` which are only available in `wcmatch.glob`.
fix
Import `wcmatch.glob` instead of the standard `glob` module: `from wcmatch import glob` then `glob.glob('**/*.txt', flags=glob.GLOBSTAR)`.
AttributeError: module 'wcmatch.path' has no attribute 'walk'
In recent versions of `wcmatch` (v8.0+), path-related functions like `walk` are methods of the `wcmatch.path.Path` class, not direct functions of the module itself.
fix
Instantiate the `Path` class and call the method on the instance: `from wcmatch.path import Path` then `Path('.').walk()`.
ModuleNotFoundError: No module named 'wcmatch'
The `wcmatch` library has not been installed in the active Python environment, or the environment where it's installed is not the one being used.
fix
Install the library using pip: `pip install wcmatch`.
ERROR: No matching distribution found for wcmatch
The Python version being used is no longer supported by the latest `wcmatch` releases, preventing `pip` from finding a compatible package.
fix
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).
Upgrade
Version history
11.0.1latest on PyPI · released Aug 14, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.9 or newer
Agent activity
47 hits · last 30 days
node
34
OpenAI (training)
1
Resources
wcmatch — pip install wcmatch · libregistry