Metadata-Version: 2.4
Name: ppathspec
Version: 0.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
License-File: LICENSE
Summary: Fast gitignore-style file path pattern matching for Python
Keywords: pathspec,gitignore,glob,pattern,matching,filesystem,rust
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/gatewaytofredom/ppathspec
Project-URL: Repository, https://github.com/gatewaytofredom/ppathspec

# ppathspec

[![CI](https://github.com/gatewaytofredom/ppathspec/actions/workflows/ci.yml/badge.svg)](https://github.com/gatewaytofredom/ppathspec/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/ppathspec.svg)](https://pypi.org/project/ppathspec/)
[![Python Versions](https://img.shields.io/pypi/pyversions/ppathspec.svg)](https://pypi.org/project/ppathspec/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/gatewaytofredom/ppathspec/blob/main/LICENSE)

Fast gitignore-style file path pattern matching for Python — a drop-in replacement for `pathspec` that is **6–11x faster** at compiling `.gitignore` rules and matching thousands of file paths.

## Install

```bash
pip install ppathspec
```

Prebuilt wheels are included for Linux, macOS, and Windows (Python 3.9+, no Rust toolchain needed).

## Usage

```python
from ppathspec import GitIgnoreSpec

spec = GitIgnoreSpec.from_lines(["*.pyc", "__pycache__/", "build/", "!build/keep.txt"])
spec.match_file("src/__pycache__/mod.cpython-312.pyc")  # True
list(spec.match_files(["src/main.py", "build/out.o", "build/keep.txt"]))  # ["build/out.o"]
```

## Performance

Benchmarked against `pathspec` v1.1.1 on a 31-rule `.gitignore` and 2,000 file paths:

| Workload | `pathspec` (x86-64) | `ppathspec` (x86-64) | `ppathspec` (Apple M4) |
|---|---:|---:|---:|
| Compile 31 rules (x200) | 17.28 ms | **1.47 ms** (11.8x) | **1.38 ms** (9.4x) |
| `match_file` (2,000 paths) | 12.02 ms | **1.57 ms** (7.7x) | **1.38 ms** (6.0x) |
| `match_files` (2,000 paths) | 11.82 ms | **1.51 ms** (7.8x) | **1.27 ms** (6.8x) |

## Under the hood

- Written in Rust (PyO3) with zero external runtime dependencies and runtime SIMD dispatch (AVX2 / SSE2 / ARM64 NEON)
- Compact `cp39-abi3` wheel (`gil_used = false`, free-threaded Python ready) with PEP 561 type stubs (`py.typed` + `__init__.pyi`)
- Verified with Hypothesis differential fuzzing against `pathspec` and tested as a drop-in replacement in `black`, `yamllint`, and `hatchling`

## License

MIT

