An open API service indexing awesome lists of open source software.

https://github.com/razerm/crabwalk

Fast recursive directory iterator which supports .gitignore files, file types, and glob filtering.
https://github.com/razerm/crabwalk

Last synced: 3 months ago
JSON representation

Fast recursive directory iterator which supports .gitignore files, file types, and glob filtering.

Awesome Lists containing this project

README

        



PyPI


Documentation


CI Status


MIT License

# crabwalk

crabwalk is a Python package built in Rust on top of the excellent [ignore][] crate:

> The ignore crate provides a fast recursive directory iterator that respects
> various filters such as globs, file types and .gitignore files.

[ignore]: https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore

## Examples

### Defaults

By default, `Walk` will recursively traverse the given path(s) while ignoring
hidden files and those matching globs found in `.gitignore` and `.ignore` files:

```python
from crabwalk import Walk

with Walk(".") as walk:
for entry in walk:
print(entry.path)
```

### Disable standard filters

To disable all default filtering (and therefore behave more like `os.walk`),
you can set the corresponding flags individually or use the helper method shown
here:

```python
from crabwalk import Walk

with Walk(".") as walk:
walk.disable_standard_filters()
for entry in walk:
print(entry.path)
```

### Advanced

Disable the hidden files filter and enable parsing of custom ignore files called
`.myignore`:

```python
from crabwalk import Walk

with Walk(".", hidden=False, custom_ignore_filenames=(".myignore",)) as walk:
for entry in walk:
print(entry.path)
```

See the documentation for all options.