gitmatch
Gitignore-style path matching
Decision gist · record as of 2026-08-14
Yes. Gitmatch is a focused, well-maintained library with zero dependencies, permissive licensing, and active development. Install it if you need to match file paths against gitignore-style patterns in Python code without shelling out to git. The only constraint is Python 3.10+.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained as of 2026-07-20 with recent release activity.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
last release 2025-12-05 (252 days) · last repo commit 2026-07-20 · 4 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 87,742 downloads/mo, #13,771 on PyPI
Alternatives
Verify before relying
import gitmatch
gi = gitmatch.compile(["foo", "!bar", "*.dir/"])
match_result = gi.match("foo/bar")
if match_result:
print(f"Matched pattern: {match_result.pattern}")- Exact behavior differences from git's wildmatch implementation (e.g., edge cases in negation or directory matching).
- Performance characteristics on large pattern sets or deeply nested paths.
What it is and what it does
Gitmatch is a pure Python library that brings gitignore pattern matching semantics to your code. You compile a list of gitignore-style patterns (including negations with `!` prefix) into a matcher object, then test relative file paths against it to determine if they match. The matcher returns a match object that tells you not just whether a path matched, but which pattern matched it and whether that pattern was a negation.
The library handles the full gitignore syntax including wildcards, directory-only patterns (trailing `/`), and negation rules. It has no external dependencies and runs on Python 3.10+, making it straightforward to embed in tools that need to respect or replicate gitignore behavior without shelling out to git itself.
Use it for
- Build tools that need to respect .gitignore rules when deciding which files to process or exclude.
- File synchronization or backup utilities that filter paths using gitignore patterns.
- Code generators or linters that should skip files matching project ignore rules.
- Testing frameworks that need to exclude test files or directories based on gitignore patterns.
- Static analysis tools that want to honor ignore patterns without invoking git.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Gitmatch is a focused, well-maintained library with zero dependencies, permissive licensing, and active development. Install it if you need to match file paths against gitignore-style patterns in Python code without shelling out to git. The only constraint is Python 3.10+.
Install
gitmatch on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 2026-07-20 with recent release activity.
Requires Python 3.10 or higher.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
Quickstart
import gitmatch
gi = gitmatch.compile(["foo", "!bar", "*.dir/"])
match_result = gi.match("foo/bar")
if match_result:
print(f"Matched pattern: {match_result.pattern}")
Verify before relying
- Exact behavior differences from git's wildmatch implementation (e.g., edge cases in negation or directory matching).
- Performance characteristics on large pattern sets or deeply nested paths.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 252 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 87,742 / month, #13,771 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Version Control :: GitTopic :: Text Processing :: FiltersTyping :: Typed |
Evidence: gitmatch-0.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “path matching with gitignore syntax”
- gitmatchGitmatch implements gitignore-style pattern matching for file paths,…
- pathspecMatches file paths against gitignore-style patterns, supporting both…
- py-walkFilters filesystem paths using gitignore-style pattern matching,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Filters packages
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Converts Markdown text to HTML using a Python implementation of John Gruber's Markdown specification, with support for extensions.
Install it if you need to parse Markdown in Python.
NLTK is a Python library for natural language processing tasks including tokenization, parsing, tagging, and linguistic analysis, with built-in datasets and educational resources.
Install it if you need foundational NLP tools, linguistic datasets, or are learning the field; consider specialized libraries (spaCy, transformers) if you need…
Provides Python utilities for writing pandoc filters that transform document ASTs by reading JSON from stdin, modifying the structure, and writing JSON to stdout.
Converts Unicode text to ASCII-safe representations by transliterating non-ASCII characters to their closest ASCII equivalents, useful for generating URL slugs, legacy system integration, and keyboard-friendly identifiers.
Install it if you need lossy Unicode-to-ASCII conversion and can accept GPLv2+ copyleft terms.
Pymdown Extensions provides a collection of additional extensions for Python Markdown that add syntax support for advanced formatting, including tabbed content, superfences with syntax highlighting, emoji, and other markup enhancements.
Install it if you need markdown features beyond the standard library.
See also pathspec · py-walk · globmatch · wcmatch · ignore-python · glob2 · igittigitt · gitignore-parser · gitignorant · ripgrep