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


Alpha - Testing Release

This repository contains the alpha (testing) version of the regex_ext library and its accompanying regex cli command‑line interface.

  • What's here
    • A core regex_ext library written in rust
    • A prototype regex command‑line tool which demonstrates functionality.
  • Current State
    • The library is functional but not yet production‑ready.
    • Some CLI commands may behave unexpectedly.
  • Why Alpha Release
    • Gather feedback from early users and contributors.
    • Identify bugs and usability issues before a stable release.
    • I still have a use case for this library in it's current state.
  • What to expect
    • Documentation/README may be incomplete and change as we refine the user experience.
    • Occasional breaking changes while we experiment with design choices.
    • Frequent updates as we stabilize APIs and fix regressions.

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 an optional regex_ext python library written in rust to improve performance of parsing large amounts of text.


Installation

Easy

  1. Using PyPi
pip install rygex

Build from source

  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) - under development after using rust
  • Fixed-string grep (-F/--fixed-string, Rust) - Under Development
  • 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 --start foo 2 --end bar 1 -f logfile.txt
    

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

  • Omit first/last chars

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

    Strips the outer parentheses from the match.

  • Omit all

    rygex --start 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.14.tar.gz (490.8 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.14-cp314-cp314-win_amd64.whl (873.0 kB view details)

Uploaded CPython 3.14Windows x86-64

rygex-0.1.14-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.14-cp313-cp313-win_amd64.whl (873.1 kB view details)

Uploaded CPython 3.13Windows x86-64

rygex-0.1.14-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.14-cp312-cp312-win_amd64.whl (873.3 kB view details)

Uploaded CPython 3.12Windows x86-64

rygex-0.1.14-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.14.tar.gz.

File metadata

  • Download URL: rygex-0.1.14.tar.gz
  • Upload date:
  • Size: 490.8 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.14.tar.gz
Algorithm Hash digest
SHA256 e338f9ee6fbc0632b678caa72c63336a931fefe412f16ab52a3e11389e2ae9e3
MD5 54b5c0ae5aa6e49fd7dc62828a79b24d
BLAKE2b-256 72724d0a55c7ee9d856b185a8f22896a7e30902fedad1e9e25de859596aa7682

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14.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.14-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.14-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 873.0 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.14-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6ebe8ac36f241a4aa8fef5e7579b93ad0db78a5d4be7c8693bb5554f282b4f8a
MD5 df3b788711a269db70d7686022f2c719
BLAKE2b-256 fcbb7da34a356d9753eec26de95f424a2f81514a0aaa327ec9d300634cbb5ace

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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.14-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.14-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 64dcdd68f8951274ad16c90b07805ab4707f8fe3accf37b2eb81de5a0a4ae10a
MD5 5cc694bb6a1d7319c7e8d2e88b5e30cc
BLAKE2b-256 4659cebb8b25a457b735e0acb0d286c906c2723aa9ed33d2229387ffcd5ba0b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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.14-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.14-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 873.1 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.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7fc876497abe705552f9e8109d2686b0188c691caee2fe7a5b24a9efd84be751
MD5 4d69126c29431623b4dac6961a69c269
BLAKE2b-256 6b86619238c654db6f30741c182eb2600bf251040ee2196e6754fe513552c1cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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.14-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.14-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7bd56dbe7487d98645bea736312b5b3ea3f6a82eabcf19fac020955ba4924614
MD5 b98eb9154842e741e0d2326be34c5d20
BLAKE2b-256 687717cdbd40eb2a2e2d5f3d6f057c97bb6ef6c2e287b49404f383f843a79ba9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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.14-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rygex-0.1.14-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 873.3 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.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2113a4e6b2ed2844656633cd6190837b1a5a45a2afa683e7e8f8946a3bff6780
MD5 44802e26a1da924444a3473d3df29cc4
BLAKE2b-256 20a6f6687bf6d721377e12245866427d935a29a965bcfd5cd15ae328c8ef246c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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.14-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for rygex-0.1.14-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6c6cceeeaeeb6385e0ca037bdc0cd90fd380747bfaa3ce38aae5e7c7e2d22e86
MD5 31d687c92e77c5ea56851f82a76fc710
BLAKE2b-256 ddb2e2308559585ff7a9cd995e00da9af407965ee2cfbcfbbc42d55914560df0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rygex-0.1.14-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