igittigitt
A spec-compliant .gitignore parser and path filter, 100% git-compatible, with an include/whitelist mode and a streaming, memory-bounded CLI
What it is and what it does
igittigitt is a Python library and command-line tool that parses .gitignore files and determines whether paths match the ignore rules. It reproduces git's matching algorithm exactly, including negations, per-directory precedence, anchors, and glob patterns (**, *, ?, character classes). The library ships with type hints and no runtime dependency on the git binary itself.
You can use it three ways: as a library to query whether a path is ignored, as a filter callback for shutil.copytree to copy directory trees while respecting .gitignore rules, or as a CLI tool that mirrors git check-ignore or acts as a Unix filter (reading paths from stdin and printing survivors). It also offers an IncludeParser mode that inverts the logic to whitelist files instead. Memory usage scales with the number of rules, not the number of files, making it suitable for large directory trees.
Use it for:
- Copy a project directory while excluding all ignored files (e.g., build artifacts, node_modules) using shutil.copytree.
- Check whether specific paths would be ignored by git without invoking the git binary.
- Filter a stream of file paths (from find or similar) to keep only non-ignored files in a pipeline.
- Build a whitelist of files to include in a distribution or archive, excluding everything else.
- Implement .gitignore-aware file operations in Python tools without shelling out to git.
- Validate or test .gitignore rules programmatically against a set of paths.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A spec-compliant .gitignore parser that matches git's algorithm exactly, available as both a library and CLI tool for checking whether paths are ignored or filtering file trees.
Yes. Active, well-maintained library with no known vulnerabilities, low install friction, and permissive licensing. Solves a real problem (git-compatible ignore matching in pure Python) with a proven algorithm. Suitable for both library and CLI use. Install if you need to respect .gitignore rules in Python code or need a standalone CLI tool for filtering paths.
Install
igittigitt on PyPI
pip
pip install igittigittuv
uv add igittigittpoetry
poetry add igittigittInstalling igittigitt
Before you install
Low friction: pure Python wheel with no compiled dependencies. Active maintenance—last release 15 days ago, last commit 2026-08-01. Targets Python 3.10+ and tested across CPython 3.10–3.14.
License in practice
MIT license (permissive). No restrictions on commercial or private use; attribution required but no copyleft obligations.
Quickstart
import igittigitt
parser = igittigitt.IgnoreParser()
parser.parse_rule_files(base_dir="/path/to/project")
parser.match("/path/to/project/file.pyc") # True if ignored
# or as a copytree filter:
import shutil
shutil.copytree("src", "dst", ignore=parser.shutil_ignore)
Requires Python 3.10 or later.
Verify before relying
- Performance characteristics on very large .gitignore files or deeply nested directory structures beyond the stated O(depth x rules) analysis.
- Whether the differential test suite against git check-ignore covers all edge cases in real-world projects.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — lib-cli-exit-tools, lib-layered-config, lib-log-rich, orjson, pydantic, rich-click, wcmatch |
| Maintenance | actively maintained — 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 134,024/month — #11,489 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: igittigitt-2.2.3-py3-none-any.whl
Keywords: cli, copytree, filter, gitignore, glob, ignore, whitelist, wildmatch
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
gitignorefileParses `.gitignore` files according to Git's…
permissive · top 15,000 on PyPI
mypy_baselineA CLI tool that captures mypy type errors as a…
permissive · top 15,000 on PyPI
gitignorantParses .gitignore files and matches file paths…
permissive · top 15,000 on PyPI
py-walkFilters filesystem paths using gitignore-style…
permissive · top 5,000 on PyPI
gitignore-parserParses .gitignore files and returns a callable…
permissive · top 5,000 on PyPI
pathspecMatches file paths against gitignore-style…
copyleft · top 100 on PyPI
gitmatchGitmatch implements gitignore-style pattern…
permissive · top 15,000 on PyPI
ignoreDownloads and installs common .gitignore…
permissive · top 15,000 on PyPI
ripgrepProvides a Python interface to ripgrep (rg), a…
permissive · top 15,000 on PyPI
rignoreProvides fast directory traversal with support…
permissive · top 1,000 on PyPI