Rust-powered blazing-fast regex search for Python
Project description
rgpy
rgpy is a blazing-fast, Rust-powered regular expression search tool for Python.
It brings the speed of ripgrep and regex into your Python environment, ideal for scanning large log files and datasets.
🚀 Features
- Super-fast regex matching (powered by Rust)
- Supports both
regexandpcre2 - Multithreaded line scanning (via Rayon)
- Easy-to-use Python API
📦 Installation
Install via pip using maturin:
pip install maturin
maturin develop # for local development
You can also install from PyPI once published:
pip install rgpy
🧪 Example Usage
from rgpy import search_file
results = search_file(
pattern="error",
path="./logs/sample.log",
engine="regex", # or "pcre2"
ignore_case=True
)
for line in results:
print(line)
⚙️ Arguments
| Parameter | Type | Description |
|---|---|---|
pattern |
str |
Regex pattern to search |
path |
str |
Path to the target file |
engine |
str |
"regex" (default) or "pcre2" |
ignore_case |
bool |
Case-insensitive matching (optional) |
🛠 Engine Options
"regex": Rust’s built-in, fast and safe regex engine (no backreferences or lookbehind)"pcre2": Perl-compatible regex with full support for lookaround, backreference, etc. (slightly slower)
⚡ Performance
rgpy uses Rust + Rayon for multithreaded file processing.
This makes it significantly faster than Python’s built-in re module, especially for large files.
📜 License
MIT License
👤 Author
Developed by [cpprhtn/Junwon Lee]
Inspired by ripgrep and pyo3
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rgpy-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: rgpy-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 949.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad6d4efc32909ed97402696a96571da95838a0e46a929571a2c0d4116b77634
|
|
| MD5 |
cfb9f995ba9d0637498811b4cd5774d9
|
|
| BLAKE2b-256 |
b8f012b037d4efff1faf637ff498fb1fd9d570f4c2e527770ac0c4fd6d0460ac
|