skillfed

igittigitt

A spec-compliant .gitignore parser and path filter, 100% git-compatible, with an include/whitelist mode and a streaming, memory-bounded CLI

igittigitt v2.2.3 134.0K downloads/30d#11,489 on PyPI29
Permissive license MIT Active released

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 igittigitt

uv

uv add igittigitt

poetry

poetry add igittigitt

Installing 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

Environment :: ConsoleLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming 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.14Typing :: Typed

Tags

gitignore parser pythongit-compatible ignore matchingfilter files by gitignore rulescopytree with gitignorewhitelist include mode filterstreaming path filter clinegation and precedence rules
gitignorefile-filteringcli-tool

More Build Tools packages