--- id: gitignorefile version: "1.1.2" license: MIT license_treatment: permissive maintenance: abandoned --- # gitignorefile — A spec-compliant `.gitignore` parser for Python License: permissive · Maintenance: abandoned · Downloads: 105.4K/mo ## What it is and what it does gitignorefile is a Python library that reads and interprets `.gitignore` files according to Git's specification. It provides functions to check whether individual file paths match ignore rules, either by parsing a single `.gitignore` file or by walking a directory tree to discover and apply all `.gitignore` and `.git/info/exclude` files in the hierarchy. The library also integrates with `shutil.copytree()` as an ignore callback and offers a caching layer to avoid re-parsing rules for repeated checks. The package has no external runtime dependencies and supports Python 3.6 through 3.12. However, it is marked as abandoned—the last commit was in May 2023 and no releases have occurred since September 2022, so it will not receive updates for new Git features or bug fixes. Use it for: - Filter files during directory copy operations to respect .gitignore rules without invoking git itself - Build tools or scripts that need to skip ignored files when scanning a project directory - Implement custom file-processing pipelines that must honor gitignore semantics - Test whether a file path would be ignored by Git without running git commands ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses `.gitignore` files according to Git's specification and checks whether file paths match the ignore rules, with support for caching and custom ignore file sources. Yes, if you need lightweight gitignore parsing with no external dependencies and your use case does not require ongoing maintenance or support for new Git features. The library is stable and works on modern Python versions, but its abandoned status means no fixes or updates will be released. Suitable for stable, self-contained projects; avoid if you need active maintenance or expect gitignore spec changes to affect your workflow. ## Install pip install gitignorefile uv add gitignorefile poetry add gitignorefile ## Installing gitignorefile Before you install: High install friction with no runtime dependencies. Package is marked abandoned (last commit 2023-05-29, 1440 days since release), though it carries a Production/Stable classifier and remains available for Python 3.6–3.12. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions. Quickstart: import gitignorefile matches = gitignorefile.parse("/path/to/.gitignore") matches("/path/to/file.pyc") # Returns True or False # Or check files against directory tree: if gitignorefile.ignored("/path/to/file.py"): print("File is ignored") Verify before relying: - Whether the package correctly handles all edge cases in the gitignore spec (e.g., negation patterns, directory-only rules, trailing slashes) - Performance characteristics when caching large directory trees with many .gitignore files - Compatibility with recent Git versions' gitignore behavior changes since the last release in 2022 ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 105.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags gitignore parser python, check if file matches gitignore, parse gitignore rules, gitignore pattern matching, ignore file handling, git ignore compliance, directory tree ignore rules, git-tooling, file-filtering [View on SkillFed](https://skillfed.io/packages/gitignorefile) · [View on PyPI](https://pypi.org/project/gitignorefile/)