skillfed

gitignorant

A parser for gitignore files

gitignorant v0.4.0 143.7K downloads/30d#11,167 on PyPI6
Permissive license DORMANT released

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 gitignorant

uv

uv add gitignorant

poetry

poetry add gitignorant

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

gitignore parsergitignore file matchinggit ignore pattern matchingparse gitignore rulesgitignore compliancefile exclusion patterns
git-integrationfile-filtering

More Build Tools packages