py-walk
Filter filesystem paths based on gitignore-like patterns
What it is and what it does
py-walk is a Python library that interprets gitignore-style patterns to filter filesystem paths. It provides two main workflows: walking a directory tree and returning only paths that match or don't match a set of patterns, or creating a parser object to test individual paths against patterns on demand. The library aims for Git wildmatch compatibility and includes tests derived from Git's own test suite.
You pass patterns as text, a list, or a .gitignore file, optionally specifying a base directory. The walk function returns a generator of Path objects; you can also filter by file vs. directory mode, or combine ignore and match rules (with ignore taking precedence). It depends only on sly for parsing and supports Python 3.7 through 3.12.
Use it for:
- Build tools or linters that need to offer users a .gitignore-style configuration file to exclude or include paths.
- Interactive scripts that need to quickly retrieve sets of files matching complex constraints without reimplementing gitignore logic.
- Test runners or deployment tools that must respect .gitignore patterns to avoid processing excluded directories.
- File synchronization or backup utilities that want to honor gitignore rules without calling out to Git itself.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Filters filesystem paths using gitignore-style pattern matching, allowing you to walk directories with include/exclude rules or test individual paths against patterns.
Yes, if you need gitignore-compatible pattern matching and can tolerate dormant maintenance. The library is lightweight, has no known vulnerabilities, and solves a specific problem well. However, if you expect active bug fixes or compatibility updates as Git evolves, consider whether the dormant status (657 days since last release) aligns with your project's needs.
Install
py-walk on PyPI
pip
pip install py-walkuv
uv add py-walkpoetry
poetry add py-walkInstalling py-walk
Before you install
Low install friction with a single runtime dependency (sly). Maintenance is dormant—last commit was 2024-10-26 and no release in 657 days—but the repository remains active and unarchived.
License in practice
MIT license (permissive); you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install py-walk
from py_walk import walk
for path in walk('some/directory', ignore=['*.pyc', '__pycache__/']):
print(path)
Verify before relying
- Whether the 500+ tests mentioned in the description are still passing against current Git versions.
- Whether dormant status means bug fixes or pattern compatibility updates are unlikely going forward.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — sly |
| Maintenance | dormant — 657 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,410,155/month — #3,941 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_walk-0.3.3-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
gitmatchGitmatch implements gitignore-style pattern…
permissive · top 15,000 on PyPI
trailrunnerWalk filesystem paths while respecting…
permissive · top 5,000 on PyPI
pathspecMatches file paths against gitignore-style…
copyleft · top 100 on PyPI
igittigittA spec-compliant .gitignore parser that matches…
permissive · top 15,000 on PyPI
gitignorefileParses `.gitignore` files according to Git's…
permissive · top 15,000 on PyPI
ignore-pythonProvides fast recursive directory traversal…
unclear · top 15,000 on PyPI
rignoreProvides fast directory traversal with support…
permissive · top 1,000 on PyPI
gitignore-parserParses .gitignore files and returns a callable…
permissive · top 5,000 on PyPI
ignoreDownloads and installs common .gitignore…
permissive · top 15,000 on PyPI
gitignorantParses .gitignore files and matches file paths…
permissive · top 15,000 on PyPI