Pathspec is a Python utility library for matching file paths using Gitignore-style patterns, including basic gitignore behavior or a spec that more closely replicates Git’s edge cases. It’s useful for selecting or excluding files from a directory tree or from explicit file lists, with optional faster regex backends (simple, hyperscan, or google-re2).
Project status
- The upstream source (cpburnz/python-pathspec) appears actively maintained, with a recent upstream push on 2026-09-28, and earlier tagged updates that continue to refine the library.
- The apparent update cadence is moderate, with tagged updates on 2026-04-23 (v1.1.0), 2026-04-27 (v1.1.1), and 2026-01-27 (v1.0.4). However, there have been no tagged update versions since v1.1.1 on 2026-04-27, even though commits occurred in late September 2026.
AI summary generated
Recent updates
v1.1.1
Release v1.1.1 is primarily focused on improved static typing support (mypy and pyright) and related type annotations across PathSpec, GitIgnoreSpec, and backend implementations. The code changes also include some runtime-adjacent adjustments around how patterns are combined and how backends assert expected internal state.
v1.1.0
Release v1.1.0 primarily updates gitignore pattern handling to match Git’s edge cases, and improves debugging output by adding better repr/str formatting and generic typing for PathSpec. The provided release notes text is minimal and refers to CHANGES.rst, which lists bug fixes around escape() and invalid range notation, plus type and debug improvements.
v1.0.4
v1.0.4 primarily addresses an issue where the re2 backend can fail when pyre2 is also installed. The diff also includes several tooling and packaging script changes related to publishing and development environments.
v1.0.3
Release v1.0.3 is primarily a bug-fix release. The release notes mention two fixes: resolving pyright strict errors for pathspec >= 1.0.0 and addressing an environment where tomllib is unavailable.
v1.0.2
Release v1.0.2 makes a small library change related to Callable typing, plus several build and CI workflow adjustments for release automation. The release notes only mention the typing fix, but the diff also includes documentation wording changes and changes to the publish tooling.
v1.0.1
v1.0.1 primarily addresses Issue #100, where creating a PathSpec using black triggered a ValueError when the pattern list was empty. The code changes show the backends were updated to support zero patterns without raising, and added tests to cover empty-pattern behavior.
Breakingv1.0.0
Release v1.0.0 introduces a new backend concept for faster regular expression matching, including optional hyperscan and re2 backends. It also renames the primary pattern style from gitwildmatch to gitignore, updates documentation accordingly, and includes several API and type signature changes. The release notes also cover Python support changes (dropping EoL Python 3.8) and multiple bug fixes.
BreakingFeaturesv0.12.1
v0.12.1 is a small release focused on fixing an issue where PathSpec.match_file could return None. The code change indicates this was addressed by coercing the internal match result to a strict boolean.
Breakingv0.12.0
v0.12.0 drops support for EOL Python 3.7, adds Python 3.12 to the supported set, and introduces new PathSpec.check_* methods that return richer match metadata via pathspec.util.CheckResult. Internally, the protected matching pipeline was refactored so pattern matching can report both include/exclude decisions and the last matching pattern index.
BreakingFeaturesv0.11.2
v0.11.2 introduces gitignore-style negation support for path matching by adding a keyword-only negate parameter to PathSpec match_* methods. It also improves gitwildmatch pattern parsing, including proper handling of patterns ending with an escaped trailing space and support for caret-based negation inside bracket expressions.
Features