Skip to main content

A fast grep tool using a Rust-powered regex extension

Project description

RYGEX

Python (with some Rust) string and regex search tool


🚀 Why RYGEX?

Tools like grep, sed, awk, tail, head are amazing—but often you find yourself piping one into another to get exactly what you need. RYGEX combines many of their capabilities in a single command-line tool, with optional Rust under-the-hood acceleration for best-in-class performance.


🛠️ Installation

  1. Clone the repo and enter
    git clone https://github.com/jonnypeace/rygex.git
    cd rygex
    
  2. Install Python dependencies
    pip install -r requirements.txt
    
  3. (Optional) Build and install the Rust extension
     # Recommended in a python virtual environment
     python3 -m venv .venv
     maturin build --release
     pip install target/wheels/rygex-*.whl --force-reinstall
    
  4. (Optional) If you need to run rygex as root but keep it in your venv, add your venv’s bin/ to secure_path in /etc/sudoers:
     # Pay attention to the paths of your virtual environment for this bit....
     # In /etc/sudoers (via `visudo`), near the top:
     Defaults    secure_path="/home/YOUR_USERNAME/.venv/bin:/usr/local/sbin:…"
    
     # Then, in your ~/.bashrc, auto-activate the venv:
     echo 'source "$HOME/.venv/bin/activate"' >> ~/.bashrc
    

Tested on Python 3.12+ (Ubuntu 24.04, Arch Linux). Other platforms may work but are untested.


💡 Features

  • String search (-s/--start, -e/--end, Rust-accelerated)
  • Fixed-string grep (-F/--fixed-string, Rust)
  • Python regex (-p/--pyreg) and Rust regex (-rp/--rpyreg)
  • Omit characters before/after matches (-of, -ol, -O)
  • Line slicing (-l/--lines) as start:stop[:step]
  • Case-insensitive search (-i/--insensitive)
  • Unique, sorted, reverse output (-u, -S, -r)
  • Count matches and total matches (-c, -t)
  • Multithreading (-m/--multi)
  • Modular Rust library (rygex_ext) for Python integration

📝 Usage

rygex [OPTIONS] -f <FILE>

Required arguments

You must supply one of:

  • -s/--start PATTERN [INDEX] -e/--end PATTERN [INDEX]
  • -p/--pyreg <REGEX> [GROUP]
  • -rp/--rpyreg <REGEX> [GROUP]
  • -F/--fixed-string <PATTERN>

…and a source:

  • -f/--file <PATH>
  • piped input (e.g. cat file | rygex -p foo). Currently, piping only works with -p as i switch support to the rust implementation.

String searches

  • Start + End

    rygex -s foo 2 --end bar 1 -f logfile.txt
    

    Finds the 2nd occurrence of foo up to the 1st bar.

  • Omit first/last chars

    rygex -s "(" 1 --end ")" 1 -of 0 -ol 0 -f logfile.txt
    

    Strips the outer parentheses from the match.

  • Omit all

    rygex -s foo --end bar -O -f logfile.txt
    

    Removes both foo and bar from the ends of each match.


Regex searches

  • Python regex
    rygex -p '\d{4}-\d{2}-\d{2}' -f data.log
    
  • Rust regex (faster)
    rygex -rp '\w+@\w+\.\w+' -f emails.txt
    

You can supply an optional group index to extract capture groups:

rygex -p 'User: (\w+)' '1' -f users.log

Common options

Flag Description
-i, --insensitive Case-insensitive matching
-l, --lines SLICE Line slicing (e.g. 0:5, -3:, 5:10:2)
-u, --unique Show unique matches only
-S, --sort Sort output (combine with -r for reverse)
-c, --counts Show per-match counts
-t, --totalcounts Show total number of matches
-m [CORES], --multi Multithreading (defaults to all available cores if no number supplied)
-v, --version Show version and exit

🔧 Roadmap

  • Improve and expand docstrings
  • Refactor into stable 1.0 branch
  • Add more benchmarks and CI tests
  • Docker container for easy deployment
  • Recursive Search through directories, with excludes
  • Improve Match, compile, search and Iterables (not just lists) using rust

📄 License

This project is licensed under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rygex-0.1.11.tar.gz (489.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rygex-0.1.11-cp314-cp314-win_amd64.whl (872.2 kB view details)

Uploaded CPython 3.14Windows x86-64

rygex-0.1.11-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

rygex-0.1.11-cp313-cp313-win_amd64.whl (872.4 kB view details)

Uploaded CPython 3.13Windows x86-64

rygex-0.1.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rygex-0.1.11-cp312-cp312-win_amd64.whl (872.4 kB view details)

Uploaded CPython 3.12Windows x86-64

rygex-0.1.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file rygex-0.1.11.tar.gz.

File metadata

  • Download URL: rygex-0.1.11.tar.gz
  • Upload date:
  • Size: 489.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rygex-0.1.11.tar.gz
Algorithm Hash digest
SHA256 cdf6f8f79f44e5a3eb9fd470fab79a959172398db982e673bcd7f77195cbd310
MD5 e7a544f89b4dbe56da4a7a4cb02521bb
BLAKE2b-256 307f52d0a92ef539b3a77824dd93ef9e38b71924c937b3309b152a616dbb3031

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11.tar.gz:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.11-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 872.2 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rygex-0.1.11-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ad6c4a00c1927b6f4981082a312f39c99562b6bf426e22f1d1c90a861bb739ac
MD5 a7eb6ffc0690447d36f8d636e683fba1
BLAKE2b-256 690bbc46ce747b82b6589158d1e9cdb6615e400e7c9d67a53328f8c84890808b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp314-cp314-win_amd64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.11-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c561b84c011ecb4513bb21e74caf0498cd68df267fd3fd619e68737b9d81be13
MD5 e7ec9b39d1bff2044e4eaa1925e91a1a
BLAKE2b-256 2e675470a92459e516e8db1f03372c84f9f05b8ed232370be4013f063f4761c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 872.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rygex-0.1.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e91368a6e06942a8f41fd31c91df36adee7b9e4386fd66d93ad5d9ae86faceef
MD5 e8aabbe9e2ac97495688e72159b2702e
BLAKE2b-256 aed597f02022a473108080de733f2b1e2c6358ee3026f3342eb5ed4c688c1f13

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp313-cp313-win_amd64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 13561dbd2584d2f7d56e5226685a1298996089058d97ec91dfb9d815bf36bd71
MD5 3a77a94355d1e4ed21ccd6ad5fb88b10
BLAKE2b-256 e48d0d9fffd9b2bffe4493fd5af1e587fcfdbab41a3a2c995037b0c75edd27a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.11-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 872.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rygex-0.1.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c45a1b4e0affc8ef2a2a10134c548fe779ab5a24550c922ddb5fd9c69bbd0fa8
MD5 18ce518636ab9afc33298dff65692021
BLAKE2b-256 6dba87f6446f7a8042f530d27eb2370240482621ac1f0440c45cf86ebe35d1cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp312-cp312-win_amd64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rygex-0.1.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4e79803b055678fb567f09c373da2d5a4c4cee6e6bc71f2913f910abca6d498e
MD5 43bec1fc8f8129109bdddbfb9dff60d1
BLAKE2b-256 b42fe4464fe2f1ed041319a0b56e604de73da88d8edeef841785caa117704de1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build.yaml on jonnypeace/rygex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page