skillfed

py-walk

Filter filesystem paths based on gitignore-like patterns

py-walk v0.3.3 1.4M downloads/30d#3,941 on PyPI8
Permissive license DORMANT released

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-walk

uv

uv add py-walk

poetry

poetry add py-walk

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

gitignore pattern matchingfilesystem path filteringdirectory walk with patternsgitignore-compatible rulespath matching library
path-filteringgitignore-compatible

More Utilities packages