Skip to content

A Python library that provides an os.walk()-compatible interface that respects .gitignore rules. Walk through your directories while automatically excluding paths matched by .gitignore patterns.

Notifications You must be signed in to change notification settings

yeger00/gitwalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitwalk

A Python library that provides an os.walk()-compatible interface that respects .gitignore rules. Walk through your directories while automatically excluding paths matched by .gitignore patterns.

Installation

Using uv:

uv pip install gitwalk

Usage

from gitwalk import gitwalk as walk

# Walk through directory respecting .gitignore rules
for dirpath, dirnames, filenames in walk("./my_project"):
    print(f"Directory: {dirpath}")
    print(f"Subdirectories: {dirnames}")
    print(f"Files: {filenames}")

Features

  • Same interface as os.walk()
  • Respects .gitignore patterns
  • Supports both topdown and bottom-up traversal
  • Handles error callbacks
  • Follows symbolic links (optional)

Tests

uv pip install -e ".[test]"
pytest

About

A Python library that provides an os.walk()-compatible interface that respects .gitignore rules. Walk through your directories while automatically excluding paths matched by .gitignore patterns.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages