gitignorant
A parser for gitignore files
What it is and what it does
Gitignorant is a Python library that reads and parses .gitignore files, then matches file paths against the rules using the same semantics Git uses (last matching rule wins). It requires Python 3.7 or newer, includes full type hints, and has no runtime dependencies. The library handles single .gitignore files directly; hierarchical .gitignore trees (where different directories have their own .gitignore files) are not built in but can be implemented by calling code.
You would use this when you need to programmatically determine whether a file should be ignored according to .gitignore rules—for example, in build tools, linters, or file synchronization utilities that need to respect the same ignore patterns as Git itself.
Use it for:
- Build tools or deployment scripts that need to exclude files matching .gitignore patterns
- Linters or code analysis tools that should skip ignored files
- File synchronization or backup utilities that respect .gitignore semantics
- Testing frameworks that filter test files based on .gitignore rules
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses .gitignore files and matches file paths against the parsed rules using Git-compliant semantics.
Yes, if you need to match files against .gitignore rules in Python code. The library is lightweight, has no dependencies, and carries a permissive license. Maintenance is dormant but the code is stable and unarchived; use it for straightforward single-file gitignore matching, but be aware that hierarchical .gitignore support requires custom integration.
Install
gitignorant on PyPI
pip
pip install gitignorantuv
uv add gitignorantpoetry
poetry add gitignorantInstalling gitignorant
Before you install
Low friction install with no runtime dependencies. Maintenance is dormant—last commit was 2025-01-03 and no release since 2024-11-01, but the repository remains active and unarchived.
License in practice
MIT license (permissive) allows free use, modification, and distribution with minimal restrictions.
Quickstart
from gitignorant import parse_gitignore_file
rules = parse_gitignore_file('.gitignore')
matches = rules.match('path/to/file.txt')
Verify before relying
- Whether the implementation fully conforms to the gitignore spec or has known limitations beyond the stated lack of direct tree support
- Performance characteristics on large .gitignore files or when matching many paths
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 651 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 143,734/month — #11,167 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gitignorant-0.4.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
gitignore-parserParses .gitignore files and returns a callable…
permissive · top 5,000 on PyPI
gitignorefileParses `.gitignore` files according to Git's…
permissive · top 15,000 on PyPI
pathspecMatches file paths against gitignore-style…
copyleft · top 100 on PyPI
igittigittA spec-compliant .gitignore parser that matches…
permissive · top 15,000 on PyPI
gitmatchGitmatch implements gitignore-style pattern…
permissive · top 15,000 on PyPI
rignoreProvides fast directory traversal with support…
permissive · top 1,000 on PyPI
py-walkFilters filesystem paths using gitignore-style…
permissive · top 5,000 on PyPI
ProtegoProtego parses robots.txt files and determines…
permissive · top 1,000 on PyPI
yara-pythonyara-python provides a Python interface to…
permissive · top 5,000 on PyPI
trailrunnerWalk filesystem paths while respecting…
permissive · top 5,000 on PyPI