ripgrep-python


Nameripgrep-python JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python native binding for ripgrep
upload_time2025-08-11 05:54:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords ripgrep search grep rust regex text-search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ripgrep-python

A Python native binding for [ripgrep](https://github.com/BurntSushi/ripgrep), a fast recursive search tool written in Rust.

This library provides a true native integration with ripgrep's Rust API, not just a subprocess wrapper, offering excellent performance and seamless integration with Python.

## Features

- **Fast recursive search** using ripgrep's core engine
- **Native integration** (no subprocess overhead)
- **Rich search options** (case sensitivity, file type filtering, glob patterns, etc.)
- **Multiple output modes** (content with line numbers, file lists, match counts)
- **ripgrep-like interface** that closely mirrors the original ripgrep command-line experience
- **Full regex support** with multiline capabilities
- **Context support** (before/after lines)
- **Pythonic API** with full type hints and IDE support
- **Type-safe** with complete `.pyi` stub files for static analysis

## Installation

- Linux: x86_64, aarch64, i686, armv7, s390x, ppc64le
- Windows: x64, x86
- macOS: Intel (x86_64), Apple Silicon (aarch64)

### From PyPI
```sh
pip install ripgrep-python
```

### From Source

You'll need Rust and Cargo installed (see [Rust installation guide](https://www.rust-lang.org/tools/install)).

```sh
# Clone the repository
git clone https://github.com/LinXueyuanStdio/ripgrep-python.git
cd ripgrep-python

# Build and install the package
pip install maturin
maturin develop
```

## Quick Start

The interface provides a `Grep` class that closely mirrors ripgrep's command-line interface:

```python
import pyripgrep

# Create a grep instance
grep = pyripgrep.Grep()

# Basic search - find files containing 'pattern'
files = grep.search("pattern")
print(files)  # ['file1.py', 'file2.rs', ...]

# Search with content and line numbers
content = grep.search("pattern", output_mode="content", n=True)
print(content)  # ['file1.py:42:matching line', ...]

# Count matches per file
counts = grep.search("pattern", output_mode="count")
print(counts)  # {'file1.py': 5, 'file2.rs': 12, ...}

# Advanced filtering
results = grep.search(
    "struct",
    path="src/",
    type="rust",
    i=True,
    C=2,
    head_limit=10
)
```
## API Documentation

The main interface is the `Grep` class, which provides a unified search method with various options:

```python
from typing import Dict, List, Literal, Optional, Union

def search(
    self,
    pattern: str,                                           # Required: regex pattern to search for
    path: Optional[str] = None,                            # Path to search (default: current directory)
    glob: Optional[str] = None,                            # Glob pattern for file filtering (e.g., "*.py")
    output_mode: Optional[Literal["content", "files_with_matches", "count"]] = None,  # Output format
    B: Optional[int] = None,                               # Lines before match (-B flag)
    A: Optional[int] = None,                               # Lines after match (-A flag)
    C: Optional[int] = None,                               # Lines before and after match (-C flag)
    n: Optional[bool] = None,                              # Show line numbers (-n flag)
    i: Optional[bool] = None,                              # Case insensitive search (-i flag)
    type: Optional[str] = None,                            # File type filter (e.g., "rust", "python")
    head_limit: Optional[int] = None,                      # Limit number of results
    multiline: Optional[bool] = None                       # Enable multiline mode (-U flag)
) -> Union[List[str], Dict[str, int]]:
    """
    Search for pattern in files with various options.

    Returns:
        - List[str]: When output_mode is "files_with_matches" (default) or "content"
        - Dict[str, int]: When output_mode is "count" (filename -> match count)
    """
```

### Output Modes

#### `files_with_matches` (default)
Returns list of file paths containing matches:
```python
files = grep.search("TODO")
# Returns: ['src/main.rs', 'docs/readme.md', ...]
```

#### `content`
Returns matching lines with optional context and line numbers:
```python
# Basic content search
lines = grep.search("function", output_mode="content")
# Returns: ['src/app.js:function myFunc() {', ...]

# With line numbers and context
lines = grep.search("error", output_mode="content",
                   n=True, C=2)
```

#### `count`
Returns match counts per file:
```python
counts = grep.search("import", output_mode="count")
# Returns: {'src/main.py': 15, 'src/utils.py': 8, ...}
```

## Usage Examples

### Basic Search
```python
import pyripgrep

grep = pyripgrep.Grep()

# Find all files containing "TODO"
files = grep.search("TODO")
for file in files:
    print(file)

# Show actual matching lines
content = grep.search("TODO", output_mode="content", n=True)
for line in content[:5]:  # First 5 matches
    print(line)
```

### File Type Filtering
```python
# Search only in Rust files
rust_files = grep.search("struct", type="rust")

# Search only in Python files
py_files = grep.search("def", type="python")

# Supported: rust, python, javascript, typescript, java, c, cpp, go, etc.
```

### Advanced Filtering
```python
# Use glob patterns
js_files = grep.search("function", glob="*.js")

# Case insensitive search
files = grep.search("ERROR", i=True)

# Search in specific directory with context
results = grep.search(
    "impl",
    path="src/",
    output_mode="content",
    C=3,
    n=True,
    head_limit=10
)
```

### Regular Expressions
```python
# Find function definitions
functions = grep.search(r"fn\s+\w+", output_mode="content", type="rust")

# Find import statements
imports = grep.search(r"^(import|from)\s+", output_mode="content", type="python")

# Multiline matching
structs = grep.search(r"struct\s+\w+\s*\{", multiline=True, output_mode="content")
```

### Performance and Statistics
```python
import time

# Time a search operation
start = time.time()
results = grep.search("pattern", path="large_directory/")
duration = time.time() - start

print(f"Found {len(results)} files in {duration:.3f} seconds")

# Get detailed match counts
counts = grep.search("pattern", output_mode="count")
total_matches = sum(counts.values())
print(f"Total matches: {total_matches} across {len(counts)} files")
```

## Comparison with ripgrep CLI

| ripgrep command | Python equivalent |
|----------------|-------------------|
| `rg pattern` | `grep.search("pattern")` |
| `rg pattern -l` | `grep.search("pattern", output_mode="files_with_matches")` |
| `rg pattern -n` | `grep.search("pattern", output_mode="content", n=True)` |
| `rg pattern -c` | `grep.search("pattern", output_mode="count")` |
| `rg pattern -i` | `grep.search("pattern", i=True)` |
| `rg pattern -A 3` | `grep.search("pattern", A=3, output_mode="content")` |
| `rg pattern -B 3` | `grep.search("pattern", B=3, output_mode="content")` |
| `rg pattern -C 3` | `grep.search("pattern", C=3, output_mode="content")` |
| `rg pattern -t py` | `grep.search("pattern", type="python")` |
| `rg pattern -g "*.js"` | `grep.search("pattern", glob="*.js")` |
| `rg pattern -U` | `grep.search("pattern", multiline=True)` |

## Type Annotations

This library provides full type hint support for better IDE experience and static type checking:

### Type-Safe API

```python
from typing import Dict, List
import pyripgrep

# Create typed instance
grep: pyripgrep.Grep = pyripgrep.Grep()

# Type inference for different output modes
files: List[str] = grep.search("pattern")  # files_with_matches mode
content: List[str] = grep.search("pattern", output_mode="content")  # content mode
counts: Dict[str, int] = grep.search("pattern", output_mode="count")  # count mode
```

### IDE Support

The library includes complete `.pyi` stub files providing:

- **IntelliSense**: Full autocompletion in VS Code, PyCharm, etc.
- **Type checking**: Works with mypy, pyright, and other static analyzers
- **Method overloads**: Different return types based on `output_mode` parameter
- **Parameter hints**: Detailed documentation for all parameters

### Example with Type Annotations

```python
from typing import Dict, List
import pyripgrep

def analyze_codebase(pattern: str, directory: str) -> Dict[str, int]:
    """Analyze codebase for pattern occurrences with full type safety."""
    grep: pyripgrep.Grep = pyripgrep.Grep()

    # Type checker knows this returns Dict[str, int]
    counts: Dict[str, int] = grep.search(
        pattern,
        path=directory,
        output_mode="count",
        i=True
    )

    return counts

# Usage with type checking
results: Dict[str, int] = analyze_codebase("TODO", "src/")
total_todos: int = sum(results.values())
```

For more examples, see `examples/typed_usage_demo.py` and `docs/TYPE_ANNOTATIONS.md`.

## Development

### Building from Source

#### Prerequisites

1. **Install Rust toolchain**:
   ```bash
   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
   source ~/.cargo/env
   ```

2. **Install Python development dependencies**:
   ```bash
   pip install maturin
   ```

#### Build and Install

```bash
# Clone the repository
git clone https://github.com/LinXueyuanStdio/ripgrep-python.git
cd ripgrep-python

# Development build (creates importable module)
maturin develop

# Or build wheel for distribution
maturin build --release
```

#### Running Examples

```bash
# Run the new interface demo
python examples/new_interface_demo.py

# Run basic usage example
python examples/basic_usage.py

# Run performance tests
python examples/test_new_interface.py
```

#### Testing

```bash
# Run Python tests
python -m pytest tests/ -v

# Test the module import
python -c "import pyripgrep; print('Import successful')"
```

### Publishing

For maintainers and contributors:

```sh
# Build for current platform
make build

# Build for all platforms
make build-all

# Publish to TestPyPI
make publish-test

# Publish to PyPI
make publish-prod
```

See [Publishing Guide](docs/PUBLISHING.md) for detailed cross-platform build instructions.

## Migration Guide

If you're using the old interface (`RipGrep` class), here's how to migrate to the new `Grep` class:

### Old Interface
```python
import pyripgrep

rg = pyripgrep.RipGrep()
options = pyripgrep.SearchOptions()
options.case_sensitive = False

results = rg.search("pattern", ["."], options)
files = rg.search_files("pattern", ["."], options)
counts = rg.count_matches("pattern", ["."], options)
```

### New Interface
```python
import pyripgrep

grep = pyripgrep.Grep()

# Search with content (equivalent to old search method)
results = grep.search("pattern", i=True, output_mode="content")

# Search for files (equivalent to old search_files method)
files = grep.search("pattern", i=True, output_mode="files_with_matches")

# Count matches (equivalent to old count_matches method)
counts = grep.search("pattern", i=True, output_mode="count")
```

## Performance

This library provides native Rust performance through direct API integration:

- **No subprocess overhead** - direct Rust function calls
- **Optimized file walking** - uses ripgrep's ignore crate for .gitignore support
- **Binary detection** - automatically skips binary files
- **Parallel processing** - leverages Rust's concurrency for large searches

Benchmark results show 10-50x performance improvement over subprocess-based solutions on large codebases.

## Troubleshooting

### Import Errors
If you get import errors, ensure maturin build completed successfully:
```bash
maturin develop --release
python -c "import pyripgrep; print('Success!')"
```

### Rust Toolchain Issues
Update Rust if you encounter build issues:
```bash
rustup update
```

### Performance Issues
For very large searches, consider using `head_limit` to restrict results:
```bash
# Limit to first 1000 results
results = grep.search("pattern", head_limit=1000)
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Run `maturin develop` to test locally
6. Submit a pull request

## License

MIT License - see LICENSE file for details

## Acknowledgments

- [BurntSushi](https://github.com/BurntSushi) for the original ripgrep tool
- [PyO3](https://github.com/PyO3/pyo3) for Rust-Python bindings
- [Maturin](https://github.com/PyO3/maturin) for building and packaging


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ripgrep-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ripgrep, search, grep, rust, regex, text-search",
    "author": null,
    "author_email": "LinXueyuanStdio <23211526+LinXueyuanStdio@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/63/a6681a4d3d34ea8e062f03376b0e63460f49db430f0dd7ed50a379419a56/ripgrep_python-0.1.0.tar.gz",
    "platform": null,
    "description": "# ripgrep-python\n\nA Python native binding for [ripgrep](https://github.com/BurntSushi/ripgrep), a fast recursive search tool written in Rust.\n\nThis library provides a true native integration with ripgrep's Rust API, not just a subprocess wrapper, offering excellent performance and seamless integration with Python.\n\n## Features\n\n- **Fast recursive search** using ripgrep's core engine\n- **Native integration** (no subprocess overhead)\n- **Rich search options** (case sensitivity, file type filtering, glob patterns, etc.)\n- **Multiple output modes** (content with line numbers, file lists, match counts)\n- **ripgrep-like interface** that closely mirrors the original ripgrep command-line experience\n- **Full regex support** with multiline capabilities\n- **Context support** (before/after lines)\n- **Pythonic API** with full type hints and IDE support\n- **Type-safe** with complete `.pyi` stub files for static analysis\n\n## Installation\n\n- Linux: x86_64, aarch64, i686, armv7, s390x, ppc64le\n- Windows: x64, x86\n- macOS: Intel (x86_64), Apple Silicon (aarch64)\n\n### From PyPI\n```sh\npip install ripgrep-python\n```\n\n### From Source\n\nYou'll need Rust and Cargo installed (see [Rust installation guide](https://www.rust-lang.org/tools/install)).\n\n```sh\n# Clone the repository\ngit clone https://github.com/LinXueyuanStdio/ripgrep-python.git\ncd ripgrep-python\n\n# Build and install the package\npip install maturin\nmaturin develop\n```\n\n## Quick Start\n\nThe interface provides a `Grep` class that closely mirrors ripgrep's command-line interface:\n\n```python\nimport pyripgrep\n\n# Create a grep instance\ngrep = pyripgrep.Grep()\n\n# Basic search - find files containing 'pattern'\nfiles = grep.search(\"pattern\")\nprint(files)  # ['file1.py', 'file2.rs', ...]\n\n# Search with content and line numbers\ncontent = grep.search(\"pattern\", output_mode=\"content\", n=True)\nprint(content)  # ['file1.py:42:matching line', ...]\n\n# Count matches per file\ncounts = grep.search(\"pattern\", output_mode=\"count\")\nprint(counts)  # {'file1.py': 5, 'file2.rs': 12, ...}\n\n# Advanced filtering\nresults = grep.search(\n    \"struct\",\n    path=\"src/\",\n    type=\"rust\",\n    i=True,\n    C=2,\n    head_limit=10\n)\n```\n## API Documentation\n\nThe main interface is the `Grep` class, which provides a unified search method with various options:\n\n```python\nfrom typing import Dict, List, Literal, Optional, Union\n\ndef search(\n    self,\n    pattern: str,                                           # Required: regex pattern to search for\n    path: Optional[str] = None,                            # Path to search (default: current directory)\n    glob: Optional[str] = None,                            # Glob pattern for file filtering (e.g., \"*.py\")\n    output_mode: Optional[Literal[\"content\", \"files_with_matches\", \"count\"]] = None,  # Output format\n    B: Optional[int] = None,                               # Lines before match (-B flag)\n    A: Optional[int] = None,                               # Lines after match (-A flag)\n    C: Optional[int] = None,                               # Lines before and after match (-C flag)\n    n: Optional[bool] = None,                              # Show line numbers (-n flag)\n    i: Optional[bool] = None,                              # Case insensitive search (-i flag)\n    type: Optional[str] = None,                            # File type filter (e.g., \"rust\", \"python\")\n    head_limit: Optional[int] = None,                      # Limit number of results\n    multiline: Optional[bool] = None                       # Enable multiline mode (-U flag)\n) -> Union[List[str], Dict[str, int]]:\n    \"\"\"\n    Search for pattern in files with various options.\n\n    Returns:\n        - List[str]: When output_mode is \"files_with_matches\" (default) or \"content\"\n        - Dict[str, int]: When output_mode is \"count\" (filename -> match count)\n    \"\"\"\n```\n\n### Output Modes\n\n#### `files_with_matches` (default)\nReturns list of file paths containing matches:\n```python\nfiles = grep.search(\"TODO\")\n# Returns: ['src/main.rs', 'docs/readme.md', ...]\n```\n\n#### `content`\nReturns matching lines with optional context and line numbers:\n```python\n# Basic content search\nlines = grep.search(\"function\", output_mode=\"content\")\n# Returns: ['src/app.js:function myFunc() {', ...]\n\n# With line numbers and context\nlines = grep.search(\"error\", output_mode=\"content\",\n                   n=True, C=2)\n```\n\n#### `count`\nReturns match counts per file:\n```python\ncounts = grep.search(\"import\", output_mode=\"count\")\n# Returns: {'src/main.py': 15, 'src/utils.py': 8, ...}\n```\n\n## Usage Examples\n\n### Basic Search\n```python\nimport pyripgrep\n\ngrep = pyripgrep.Grep()\n\n# Find all files containing \"TODO\"\nfiles = grep.search(\"TODO\")\nfor file in files:\n    print(file)\n\n# Show actual matching lines\ncontent = grep.search(\"TODO\", output_mode=\"content\", n=True)\nfor line in content[:5]:  # First 5 matches\n    print(line)\n```\n\n### File Type Filtering\n```python\n# Search only in Rust files\nrust_files = grep.search(\"struct\", type=\"rust\")\n\n# Search only in Python files\npy_files = grep.search(\"def\", type=\"python\")\n\n# Supported: rust, python, javascript, typescript, java, c, cpp, go, etc.\n```\n\n### Advanced Filtering\n```python\n# Use glob patterns\njs_files = grep.search(\"function\", glob=\"*.js\")\n\n# Case insensitive search\nfiles = grep.search(\"ERROR\", i=True)\n\n# Search in specific directory with context\nresults = grep.search(\n    \"impl\",\n    path=\"src/\",\n    output_mode=\"content\",\n    C=3,\n    n=True,\n    head_limit=10\n)\n```\n\n### Regular Expressions\n```python\n# Find function definitions\nfunctions = grep.search(r\"fn\\s+\\w+\", output_mode=\"content\", type=\"rust\")\n\n# Find import statements\nimports = grep.search(r\"^(import|from)\\s+\", output_mode=\"content\", type=\"python\")\n\n# Multiline matching\nstructs = grep.search(r\"struct\\s+\\w+\\s*\\{\", multiline=True, output_mode=\"content\")\n```\n\n### Performance and Statistics\n```python\nimport time\n\n# Time a search operation\nstart = time.time()\nresults = grep.search(\"pattern\", path=\"large_directory/\")\nduration = time.time() - start\n\nprint(f\"Found {len(results)} files in {duration:.3f} seconds\")\n\n# Get detailed match counts\ncounts = grep.search(\"pattern\", output_mode=\"count\")\ntotal_matches = sum(counts.values())\nprint(f\"Total matches: {total_matches} across {len(counts)} files\")\n```\n\n## Comparison with ripgrep CLI\n\n| ripgrep command | Python equivalent |\n|----------------|-------------------|\n| `rg pattern` | `grep.search(\"pattern\")` |\n| `rg pattern -l` | `grep.search(\"pattern\", output_mode=\"files_with_matches\")` |\n| `rg pattern -n` | `grep.search(\"pattern\", output_mode=\"content\", n=True)` |\n| `rg pattern -c` | `grep.search(\"pattern\", output_mode=\"count\")` |\n| `rg pattern -i` | `grep.search(\"pattern\", i=True)` |\n| `rg pattern -A 3` | `grep.search(\"pattern\", A=3, output_mode=\"content\")` |\n| `rg pattern -B 3` | `grep.search(\"pattern\", B=3, output_mode=\"content\")` |\n| `rg pattern -C 3` | `grep.search(\"pattern\", C=3, output_mode=\"content\")` |\n| `rg pattern -t py` | `grep.search(\"pattern\", type=\"python\")` |\n| `rg pattern -g \"*.js\"` | `grep.search(\"pattern\", glob=\"*.js\")` |\n| `rg pattern -U` | `grep.search(\"pattern\", multiline=True)` |\n\n## Type Annotations\n\nThis library provides full type hint support for better IDE experience and static type checking:\n\n### Type-Safe API\n\n```python\nfrom typing import Dict, List\nimport pyripgrep\n\n# Create typed instance\ngrep: pyripgrep.Grep = pyripgrep.Grep()\n\n# Type inference for different output modes\nfiles: List[str] = grep.search(\"pattern\")  # files_with_matches mode\ncontent: List[str] = grep.search(\"pattern\", output_mode=\"content\")  # content mode\ncounts: Dict[str, int] = grep.search(\"pattern\", output_mode=\"count\")  # count mode\n```\n\n### IDE Support\n\nThe library includes complete `.pyi` stub files providing:\n\n- **IntelliSense**: Full autocompletion in VS Code, PyCharm, etc.\n- **Type checking**: Works with mypy, pyright, and other static analyzers\n- **Method overloads**: Different return types based on `output_mode` parameter\n- **Parameter hints**: Detailed documentation for all parameters\n\n### Example with Type Annotations\n\n```python\nfrom typing import Dict, List\nimport pyripgrep\n\ndef analyze_codebase(pattern: str, directory: str) -> Dict[str, int]:\n    \"\"\"Analyze codebase for pattern occurrences with full type safety.\"\"\"\n    grep: pyripgrep.Grep = pyripgrep.Grep()\n\n    # Type checker knows this returns Dict[str, int]\n    counts: Dict[str, int] = grep.search(\n        pattern,\n        path=directory,\n        output_mode=\"count\",\n        i=True\n    )\n\n    return counts\n\n# Usage with type checking\nresults: Dict[str, int] = analyze_codebase(\"TODO\", \"src/\")\ntotal_todos: int = sum(results.values())\n```\n\nFor more examples, see `examples/typed_usage_demo.py` and `docs/TYPE_ANNOTATIONS.md`.\n\n## Development\n\n### Building from Source\n\n#### Prerequisites\n\n1. **Install Rust toolchain**:\n   ```bash\n   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n   source ~/.cargo/env\n   ```\n\n2. **Install Python development dependencies**:\n   ```bash\n   pip install maturin\n   ```\n\n#### Build and Install\n\n```bash\n# Clone the repository\ngit clone https://github.com/LinXueyuanStdio/ripgrep-python.git\ncd ripgrep-python\n\n# Development build (creates importable module)\nmaturin develop\n\n# Or build wheel for distribution\nmaturin build --release\n```\n\n#### Running Examples\n\n```bash\n# Run the new interface demo\npython examples/new_interface_demo.py\n\n# Run basic usage example\npython examples/basic_usage.py\n\n# Run performance tests\npython examples/test_new_interface.py\n```\n\n#### Testing\n\n```bash\n# Run Python tests\npython -m pytest tests/ -v\n\n# Test the module import\npython -c \"import pyripgrep; print('Import successful')\"\n```\n\n### Publishing\n\nFor maintainers and contributors:\n\n```sh\n# Build for current platform\nmake build\n\n# Build for all platforms\nmake build-all\n\n# Publish to TestPyPI\nmake publish-test\n\n# Publish to PyPI\nmake publish-prod\n```\n\nSee [Publishing Guide](docs/PUBLISHING.md) for detailed cross-platform build instructions.\n\n## Migration Guide\n\nIf you're using the old interface (`RipGrep` class), here's how to migrate to the new `Grep` class:\n\n### Old Interface\n```python\nimport pyripgrep\n\nrg = pyripgrep.RipGrep()\noptions = pyripgrep.SearchOptions()\noptions.case_sensitive = False\n\nresults = rg.search(\"pattern\", [\".\"], options)\nfiles = rg.search_files(\"pattern\", [\".\"], options)\ncounts = rg.count_matches(\"pattern\", [\".\"], options)\n```\n\n### New Interface\n```python\nimport pyripgrep\n\ngrep = pyripgrep.Grep()\n\n# Search with content (equivalent to old search method)\nresults = grep.search(\"pattern\", i=True, output_mode=\"content\")\n\n# Search for files (equivalent to old search_files method)\nfiles = grep.search(\"pattern\", i=True, output_mode=\"files_with_matches\")\n\n# Count matches (equivalent to old count_matches method)\ncounts = grep.search(\"pattern\", i=True, output_mode=\"count\")\n```\n\n## Performance\n\nThis library provides native Rust performance through direct API integration:\n\n- **No subprocess overhead** - direct Rust function calls\n- **Optimized file walking** - uses ripgrep's ignore crate for .gitignore support\n- **Binary detection** - automatically skips binary files\n- **Parallel processing** - leverages Rust's concurrency for large searches\n\nBenchmark results show 10-50x performance improvement over subprocess-based solutions on large codebases.\n\n## Troubleshooting\n\n### Import Errors\nIf you get import errors, ensure maturin build completed successfully:\n```bash\nmaturin develop --release\npython -c \"import pyripgrep; print('Success!')\"\n```\n\n### Rust Toolchain Issues\nUpdate Rust if you encounter build issues:\n```bash\nrustup update\n```\n\n### Performance Issues\nFor very large searches, consider using `head_limit` to restrict results:\n```bash\n# Limit to first 1000 results\nresults = grep.search(\"pattern\", head_limit=1000)\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Run `maturin develop` to test locally\n6. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details\n\n## Acknowledgments\n\n- [BurntSushi](https://github.com/BurntSushi) for the original ripgrep tool\n- [PyO3](https://github.com/PyO3/pyo3) for Rust-Python bindings\n- [Maturin](https://github.com/PyO3/maturin) for building and packaging\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python native binding for ripgrep",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/LinXueyuanStdio/ripgrep-python",
        "Issues": "https://github.com/LinXueyuanStdio/ripgrep-python/issues",
        "Repository": "https://github.com/LinXueyuanStdio/ripgrep-python"
    },
    "split_keywords": [
        "ripgrep",
        " search",
        " grep",
        " rust",
        " regex",
        " text-search"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f47de43b9e056bdc6e363de010db0ccdd8fe2a3cd7cec23e9bcc7d7704935d0b",
                "md5": "42c7455893494e6503c3ba09a9275589",
                "sha256": "5ff217f9bcfddcec9bcb6b55311c67d5731152710e67e514a3182cb3e165cba1"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl",
            "has_sig": false,
            "md5_digest": "42c7455893494e6503c3ba09a9275589",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1334652,
            "upload_time": "2025-08-11T05:53:50",
            "upload_time_iso_8601": "2025-08-11T05:53:50.750373Z",
            "url": "https://files.pythonhosted.org/packages/f4/7d/e43b9e056bdc6e363de010db0ccdd8fe2a3cd7cec23e9bcc7d7704935d0b/ripgrep_python-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b0bb5437c8f3502ae1b83a7c30043f89c61ed3dd31918fcfe5310ed7b3f2c3a5",
                "md5": "4d241109ea01c171ce5909f0437be880",
                "sha256": "8aa4f646e93a1341b779c1870de5e62169495a0b93e0c619476e931777c36bca"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "4d241109ea01c171ce5909f0437be880",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1275487,
            "upload_time": "2025-08-11T05:53:52",
            "upload_time_iso_8601": "2025-08-11T05:53:52.797882Z",
            "url": "https://files.pythonhosted.org/packages/b0/bb/5437c8f3502ae1b83a7c30043f89c61ed3dd31918fcfe5310ed7b3f2c3a5/ripgrep_python-0.1.0-cp38-abi3-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "64f244bd9fcf27c13191c090199c7b563f536f4b71a3006a652ba31288bf635d",
                "md5": "821a3ef971fa0b90195c167ea0e962ef",
                "sha256": "5928262ba81d922ccce8a8a387e96d3aa9217a4b1a7be12ff18d87e0334643b0"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "821a3ef971fa0b90195c167ea0e962ef",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1423744,
            "upload_time": "2025-08-11T05:53:54",
            "upload_time_iso_8601": "2025-08-11T05:53:54.299621Z",
            "url": "https://files.pythonhosted.org/packages/64/f2/44bd9fcf27c13191c090199c7b563f536f4b71a3006a652ba31288bf635d/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "02c1b81de4dcff929426cc3191eeb6366efc3a67fbacbb0467d986ef8814447c",
                "md5": "2f3e03f4fdc3e871ea3bf45ed3638407",
                "sha256": "37aaca93eac7fadfcf5f946a360129ce589f8e4aae60c8048a7d33f5227a444b"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
            "has_sig": false,
            "md5_digest": "2f3e03f4fdc3e871ea3bf45ed3638407",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1364436,
            "upload_time": "2025-08-11T05:53:56",
            "upload_time_iso_8601": "2025-08-11T05:53:56.066322Z",
            "url": "https://files.pythonhosted.org/packages/02/c1/b81de4dcff929426cc3191eeb6366efc3a67fbacbb0467d986ef8814447c/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ce7f20ec138c20fb65dfa0b4c855bd3eb9312c7398d999d8301d8898bbb71216",
                "md5": "498d4c60a8125ca8e61343a8f04c9cef",
                "sha256": "3f7ed9c704d894bc01982a35037547b90267d6bbf799a6a48045dabf67f19ec4"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
            "has_sig": false,
            "md5_digest": "498d4c60a8125ca8e61343a8f04c9cef",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1729797,
            "upload_time": "2025-08-11T05:53:57",
            "upload_time_iso_8601": "2025-08-11T05:53:57.820988Z",
            "url": "https://files.pythonhosted.org/packages/ce/7f/20ec138c20fb65dfa0b4c855bd3eb9312c7398d999d8301d8898bbb71216/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5dc0537e83ac7e46126de8b75ae45f462386eb84341261daec184462701727b2",
                "md5": "15f304105fb62a2e7255bbba68d472f6",
                "sha256": "254bbc06e6ff3bf50f248c1077b1a160fd20ffe310d5c6776a13063285e9c26c"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
            "has_sig": false,
            "md5_digest": "15f304105fb62a2e7255bbba68d472f6",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1540773,
            "upload_time": "2025-08-11T05:53:59",
            "upload_time_iso_8601": "2025-08-11T05:53:59.045670Z",
            "url": "https://files.pythonhosted.org/packages/5d/c0/537e83ac7e46126de8b75ae45f462386eb84341261daec184462701727b2/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "56397e4712d8a1db1404df212d14cadbdca1b157270e0f717f9597a5c18b8741",
                "md5": "ede4e97ee345973b3ff95acd16017b4a",
                "sha256": "5e12708281f7162c4d98b7cd0e867dee2717024f1db0a1b07edbf20853b25d7a"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ede4e97ee345973b3ff95acd16017b4a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1475731,
            "upload_time": "2025-08-11T05:54:00",
            "upload_time_iso_8601": "2025-08-11T05:54:00.602358Z",
            "url": "https://files.pythonhosted.org/packages/56/39/7e4712d8a1db1404df212d14cadbdca1b157270e0f717f9597a5c18b8741/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4cde94b3a09298f09e1a5fc5679c19f198e9cf3210e015c6c95900da847c9663",
                "md5": "5b1ab9201fa4956b2574fe311dda5afb",
                "sha256": "fbec833152ee45535d1d72d6862e283a5153ccd16b73e9ea01745c33ba8a165f"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
            "has_sig": false,
            "md5_digest": "5b1ab9201fa4956b2574fe311dda5afb",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1491116,
            "upload_time": "2025-08-11T05:54:02",
            "upload_time_iso_8601": "2025-08-11T05:54:02.217919Z",
            "url": "https://files.pythonhosted.org/packages/4c/de/94b3a09298f09e1a5fc5679c19f198e9cf3210e015c6c95900da847c9663/ripgrep_python-0.1.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ede4343ff4c1aca92466fdef4647534fefd97c9bcf52bd913096b49464e60699",
                "md5": "84617adbd90d8ff756487c0e6cecb50a",
                "sha256": "c73d8d79e92a03b4435b53e4833bc4af332bfe59f028d2f7e1779e0080540398"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-win32.whl",
            "has_sig": false,
            "md5_digest": "84617adbd90d8ff756487c0e6cecb50a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1056955,
            "upload_time": "2025-08-11T05:54:03",
            "upload_time_iso_8601": "2025-08-11T05:54:03.424195Z",
            "url": "https://files.pythonhosted.org/packages/ed/e4/343ff4c1aca92466fdef4647534fefd97c9bcf52bd913096b49464e60699/ripgrep_python-0.1.0-cp38-abi3-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a2836b1130015ab911759c52b67adb67ede998b6d8dc8f13732c27ceebb79698",
                "md5": "d2ff68db3a556cf62ebf61995119ccd4",
                "sha256": "2fe265a967c5c753efa44557e35d577834902601972a24fd965362b8eea54203"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0-cp38-abi3-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d2ff68db3a556cf62ebf61995119ccd4",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1153340,
            "upload_time": "2025-08-11T05:54:04",
            "upload_time_iso_8601": "2025-08-11T05:54:04.997587Z",
            "url": "https://files.pythonhosted.org/packages/a2/83/6b1130015ab911759c52b67adb67ede998b6d8dc8f13732c27ceebb79698/ripgrep_python-0.1.0-cp38-abi3-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1163a6681a4d3d34ea8e062f03376b0e63460f49db430f0dd7ed50a379419a56",
                "md5": "73d66dbd3442f0b4d25c487c1f0f6845",
                "sha256": "0024b2209a8ef8fb7abf9d2c0ecca6e24e218b097475e0df56496d0337eac176"
            },
            "downloads": -1,
            "filename": "ripgrep_python-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "73d66dbd3442f0b4d25c487c1f0f6845",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 51086,
            "upload_time": "2025-08-11T05:54:06",
            "upload_time_iso_8601": "2025-08-11T05:54:06.094980Z",
            "url": "https://files.pythonhosted.org/packages/11/63/a6681a4d3d34ea8e062f03376b0e63460f49db430f0dd7ed50a379419a56/ripgrep_python-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 05:54:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LinXueyuanStdio",
    "github_project": "ripgrep-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ripgrep-python"
}
        
Elapsed time: 0.94130s