skillfed

gitignore-parser

A spec-compliant gitignore parser for Python 3.5+

gitignore-parser v0.1.13 3.0M downloads/30d#2,799 on PyPI221
Permissive license MIT AGING released

What it is and what it does

gitignore_parser is a Python library that reads .gitignore files and produces a callable matcher function. You pass it a gitignore file path or a string of gitignore rules, and it returns a function that you can call with file paths to determine whether they match the ignore patterns. The library claims to support the full gitignore spec, including features like square-bracket character classes (e.g., `*.py[cod]`) and top-level path anchors (e.g., `/...`), which the author notes are missing from some competing libraries.

The package has no runtime dependencies and supports Python 3.5 through 3.12. It was first released in 2018 and has been maintained sporadically; the most recent release was 354 days ago. The repository remains active with recent commits, but the long release interval suggests the package may be in a stable-but-not-actively-developed state.

Use it for:

  • Build tools and file processors that need to respect .gitignore rules when scanning project directories.
  • Testing frameworks that want to exclude ignored files from test discovery or coverage reports.
  • Version control utilities or scripts that programmatically check whether files should be tracked.
  • Project analysis tools that need to filter out ignored paths when walking a directory tree.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses .gitignore files and returns a callable matcher that tests whether file paths should be ignored according to gitignore rules.

Yes, if you need to programmatically evaluate gitignore rules in Python. The package is stable, has no dependencies, supports a wide range of Python versions, and carries no known vulnerabilities. The long release interval and aging maintenance status are not blockers for a mature, single-purpose library, but you should verify that it handles your specific gitignore patterns correctly before relying on it in production.

Install

gitignore-parser on PyPI

pip

pip install gitignore-parser

uv

uv add gitignore-parser

poetry

poetry add gitignore-parser

Installing gitignore-parser

Before you install

High install friction: the package has no runtime dependencies but has not been released in 354 days, and its status is marked as aging. The repository is not archived and has recent commits, but the long gap between releases may indicate limited active maintenance.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

from gitignore_parser import parse_gitignore
matches = parse_gitignore('/path/to/.gitignore')
if matches('/path/to/file.pyc'):
    print('File is ignored')

Verify before relying

  • Whether the package handles all edge cases of the gitignore spec (the description mentions it aims to be spec-compliant but does not detail which spec version or known limitations).
  • Current test coverage and whether the aging maintenance status reflects active use or dormancy.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance aging — 354 days since the last release
Last repo commit
First released
Downloads 2,988,275/month — #2,799 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: gitignore_parser-0.1.13.tar.gz

Keywords: gitignore

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

gitignore parserparse gitignore rulesgitignore file matchercheck if file matches gitignoregitignore pattern matchingspec-compliant gitignoregitignore pattern tester
gitignorefile-matchingbuild-tools

More Libraries packages