### Install gitignore_parser using pip Source: https://github.com/mherrmann/gitignore_parser/blob/master/README.md This command installs the gitignore_parser library from PyPI, making it available for use in Python projects. ```bash pip install gitignore_parser ``` -------------------------------- ### Parse .gitignore content from string Source: https://github.com/mherrmann/gitignore_parser/blob/master/README.md Shows how to use the parse_gitignore_str function to parse .gitignore rules directly from a string, specifying a base directory for relative path matching. ```python from gitignore_parser import parse_gitignore_str matches = parse_gitignore_str( '__pycache__/\n*.py[cod]', base_dir='/home/michael/project') print(matches('/home/michael/project/main.py')) print(matches('/home/michael/project/main.pyc')) ``` -------------------------------- ### Parse .gitignore file and check matches Source: https://github.com/mherrmann/gitignore_parser/blob/master/README.md Demonstrates how to use the parse_gitignore function to load a .gitignore file and then use the returned matcher function to check if specific file paths should be ignored. ```python from gitignore_parser import parse_gitignore matches = parse_gitignore('/home/michael/project/.gitignore') print(matches('/home/michael/project/main.py')) print(matches('/home/michael/project/main.pyc')) print(matches('/home/michael/project/dir/main.pyc')) print(matches('/home/michael/project/__pycache__')) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.