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.15.tar.gz (490.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.15-cp314-cp314-win_amd64.whl (873.1 kB view details)

Uploaded CPython 3.14Windows x86-64

rygex-0.1.15-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.15-cp313-cp313-win_amd64.whl (873.2 kB view details)

Uploaded CPython 3.13Windows x86-64

rygex-0.1.15-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.15-cp312-cp312-win_amd64.whl (873.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rygex-0.1.15-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.15.tar.gz.

File metadata

  • Download URL: rygex-0.1.15.tar.gz
  • Upload date:
  • Size: 490.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.15.tar.gz
Algorithm Hash digest
SHA256 c438cb8feba98861e4fc1186d977371a2a3b6aa2b3c9f58de345a2ad3fe0fe02
MD5 564acadc6d28bec9fd87acbc39f42b50
BLAKE2b-256 3e1c023ddb32c9bb5ef986c4c44b19c17a65f29d533c57fb813b58fedff28c01

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.15-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 873.1 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.15-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3c7cff7b102d67cbe06ace3e7315032f765a0177635957c728a55a3701989a7d
MD5 5906059917210303ffabdd9535cadc16
BLAKE2b-256 cf343d70125e5645e67ba6152423a7537b44a306008f0011eeeb7bb12fbe7c73

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.15-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5eb89e7d8491caa1ab1045b584dd81a5f269e4421d4022513526ac6e72b1abd5
MD5 c7680171ade74b80c6313d219ba23178
BLAKE2b-256 aa4e05613243a47392a58890c6147776bbba5d0f290cd33c18e95c79e12163df

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.15-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 873.2 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.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e6c3d342a58b771010a3973b39ffe53d274ede59fb921a3dea5b491dbdbffdc9
MD5 9032592a8c89a5c49c21b1c84696264f
BLAKE2b-256 27230a2dab005a3ca8c49dd054f29a0e703f063addd2bd4629c97388ffb61ec3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.15-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e646f6fd68b5e6e8fb9b50da1d0a06edff350d75390ddb79f7f74af118861dcc
MD5 6b2de68b737b171d3fbb92c7673155cd
BLAKE2b-256 0eeafd43b3a81f53400d75dea9d483e9af37c3ce631dbb00a0e134fb9cbd62d2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.15-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 873.5 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.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13e3ad5ff1f30ad417bdd721f79c2be82ef48a4730f3dfe07bdf2ffbb02c4dd1
MD5 7e679db8c70b2f86740527d74e4e77cc
BLAKE2b-256 9fbe50eb59402c82f9674064768740ed1a77a47a4d1b70489205577810e31259

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.15-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b011475bbce8d8afb67e0b22e0789920fb458c0de528c19dc3eed44c4bca62d1
MD5 01781b7bea1cb16e79d429e3376589dd
BLAKE2b-256 9d09656b6bffa81dda3e699fb68bd054e76aa7e4920f4399ea4b9dd75b40aa60

See more details on using hashes here.

Provenance

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