Registry / serialization / gitmatch

gitmatch

JSON →
library0.3.0pypypi✓ verified 81d ago

Library for matching file paths against gitignore-style patterns. Version 0.3.0, released infrequently.

pip install gitmatch
INSTALL
IMPORT
SIG · GITMATCH
G
gitmatch
serializationpythonv0.3.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · 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.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

Gitignore
from gitmatch import Gitignore
from gitmatch import GitMatch
Pattern
from gitmatch import Pattern
Match
from gitmatch import Match

Create a matcher from a list of patterns and test paths.

from gitmatch import GitMatch patterns = ['*.pyc', '__pycache__/'] matcher = GitMatch(patterns) print(matcher.matches('foo.pyc')) # True print(matcher.matches('main.py')) # False
Debug
Known issues
gotchaGitMatch expects patterns relative to the root, not absolute paths. Do not include leading slashes.
fix
Use patterns like '*.log' not '/tmp/*.log'.
affects: *
gotchaThe GitMatch constructor does not accept pathlib.Path objects directly; convert to str first.
fix
matcher = GitMatch([str(p) for p in patterns])
affects: *
breakingIn version 0.3.0, the API changed: GitMatch instances are no longer callable. Use .matches() instead.
fix
Replace matcher(path) with matcher.matches(path).
affects: >=0.3.0
Upgrade
Version history
0.3.0latest on PyPI · released Dec 5, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
gitmatch — pip install gitmatch · libregistry