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.13.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.13-cp314-cp314-win_amd64.whl (873.0 kB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.13Windows x86-64

rygex-0.1.13-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.13-cp312-cp312-win_amd64.whl (873.2 kB view details)

Uploaded CPython 3.12Windows x86-64

rygex-0.1.13-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.13.tar.gz.

File metadata

  • Download URL: rygex-0.1.13.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.13.tar.gz
Algorithm Hash digest
SHA256 146405076b503a13e69f3c67aa6d4580c194e7ac43aad5dfd4f396c436680f95
MD5 258114ddd06a5c481915db6ac037f15e
BLAKE2b-256 88e63a4c3a5ea8c07edb4e63135c06f1a697833247222b086c44fa5eb7317f67

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.13-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.13-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 dd27881b23d9149a438b19854d3a0d277c4ff80b131801d1eb06e2bfe9610842
MD5 5a3ed0f954cd492750de15789fcdc441
BLAKE2b-256 7b7ed2de8ea8c3c10f2c52afa62d3cd4e9fc172791eae30cee8125f45d26d479

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.13-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c7c63521c4b3e9c71e25187c8d3724f2a3db04320e75909f1c4fc09e0524a79d
MD5 3839eb602fb93c06e54b5c7efdbf56b2
BLAKE2b-256 a7f3c364b8c2b9769bfbde3d6a28714f29c5ef9630ac7b2bbdf0567e36c3e835

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.13-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.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5810195ac25fc31ff9dd2fa50d31a77ab4febff064679d253349530d58ca080f
MD5 1022bc6aa70ea3046143f9873caa0620
BLAKE2b-256 03be8340bfeead905d130d731f2919298fd9dcda1a2badccea66cbdca6c94b14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.13-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 44f9ff94306ea643d9ad03508e86b4773997e40e8bb89cef9aa3afe57199f8ef
MD5 bcb34f34ab7cb72d302c26c6191395e6
BLAKE2b-256 9ebb19e7238d2ff0b04195dcd107172552e8bf1207fa113092462b8795d296c2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.13-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 873.2 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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7608b551fbd3a35e2a3dea1d47000fa41678f3d79ee7267a0ea12c64b7aa557a
MD5 6e7782177c8c268a545db947e7f151b2
BLAKE2b-256 0a38d2b87c7a88efec33eb3419249b565532810ee036475768f84985bc085d0b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.13-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 583d2e3463573b20f1960d58c3415001a4666e4c55d542a0cec99cb095d75470
MD5 12148d14af7eeea1a22d0fdfdd67d5d8
BLAKE2b-256 9e68cc8df9e71e852ed6388aabf267370e0b67010b077168f31ed869114c2e72

See more details on using hashes here.

Provenance

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