Wcmatch

Bash-style wildcard file matching, globbing, and pathlib for Python

Library
PyPI
v11.0.1
166stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
72/100Good
Development Activity76
Maintenance80
Community52
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture75
Code Quality80
Innovation65
Learning Curve82

Wcmatch is a Python library that reimplements and extends the stdlib fnmatch, glob, and pathlib modules with the richer wildcard semantics found in Bash — brace expansion, extended glob pattern groups, escaping, ** recursive globbing, and POSIX character classes. It also adds a path-centric globmatch function and a standalone file-search utility.

Originally split out of the Rummage file-search tool by maintainer Isaac Muse (facelessuser), Wcmatch is now a standalone dependency used by other projects needing more expressive file/path pattern matching than Python’s builtins provide.

What You Get

  • Enhanced fnmatch, glob, and pathlib modules with a superset of stdlib functionality
  • globmatch for matching path strings against glob patterns without filesystem access
  • Bash-style features: brace expansion, extended glob groups (@(...), +(...), etc.), and \ escaping
  • POSIX character class support ([[:alnum:]]) using the C locale
  • A standalone wcmatch file-crawler utility built on top of the core matching engine

Common Use Cases

  • Implementing .gitignore-style or Bash-glob-compatible file filtering in Python tools
  • Validating whether arbitrary path strings match user-supplied glob patterns
  • Replacing Python’s builtin glob/fnmatch where brace expansion or extended patterns are needed
  • Building CLI tools or linters that need configurable, Bash-familiar file selection patterns

Under The Hood

Architecture - The library centers on a shared parsing/matching engine (_wcparse.py, _wcmatch.py) that compiles glob/fnmatch patterns into regular expressions, with thin public-facing modules (fnmatch.py, glob.py, pathlib.py, posix.py) exposing stdlib-compatible entry points layered on top of that shared core. Tech Stack - Pure Python with no runtime dependencies beyond the standard library, using py.typed for inline type hint distribution and standard setuptools packaging. Code Quality - The tests/ directory has dedicated test modules per public interface (test_fnmatch.py, test_glob.py, test_globmatch.py, test_pathlib.py, test_wcparse.py) plus Codecov-tracked coverage, indicating disciplined per-surface testing. API Design - By deliberately mirroring the signatures of fnmatch/glob/pathlib, the library keeps the learning curve low for anyone familiar with Python’s stdlib, while documenting its Bash-derived extensions clearly on a dedicated docs site.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search