rignore is a Python module that provides high-performance, Rust-powered file system traversal functionality. It efficiently walks through directories while respecting various ignore rules, such as those found in `.gitignore` files. It wraps the Rust `ignore` crate using PyO3, offering a fast and customizable API. The current version is 0.7.6, with a relatively active release cadence.
pip install rignoreVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `rignore.walk` to traverse a directory while respecting a `.gitignore` file. It creates a temporary directory structure and then prints the paths of files not ignored.
Understand that `overrides` are powerful and take precedence. Use them specifically when you want to invert or drastically alter the default ignore behavior. For adding simple extra ignore patterns, prefer `additional_ignores`.
Carefully review the interaction between `.gitignore` files in the directory hierarchy and any programmatic `additional_ignores` or `overrides` you supply. Test your ignore patterns thoroughly to ensure the correct files are being processed.
Install the Rust toolchain using `rustup install stable` (recommended) or your operating system's package manager before running `pip install rignore`.
Import `Walker` directly from the `rignore` package: `from rignore import Walker`.
Create an instance of `rignore.Walker` and then call its `walk()` method: `walker = rignore.Walker('path/to/dir'); for entry in walker.walk(): ...`.Ensure the `path` argument passed to `rignore.Walker` is a string: `walker = rignore.Walker('/home/user/my_project')`.No dependency data recorded yet.