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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.13Windows x86-64

rygex-0.1.12-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.12-cp312-cp312-win_amd64.whl (873.4 kB view details)

Uploaded CPython 3.12Windows x86-64

rygex-0.1.12-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.12.tar.gz.

File metadata

  • Download URL: rygex-0.1.12.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.12.tar.gz
Algorithm Hash digest
SHA256 c660f946499bc556483b14f113ba90e44768aca84b25a8f4628714efe1191c16
MD5 c21d9aa15da9b064b1ac1c483bf7f2d2
BLAKE2b-256 39d838037a8f46049b2b1d6e4b777340fd2e8e080dbc3af672815e11322ecd5c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.12-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.12-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 09aa7990826b5ee8d4ebe25f89d11ce6d7bc61a25c24d033498c387e8b0ee194
MD5 200732a8e3c70b1f8c4bad95586d1080
BLAKE2b-256 86f2b26a7c30c38f13eb105256603d40ff71ce687f925ad6fcd2c522c18d1999

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.12-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 659a60f28242255d0c1f5035b5bbc70c0e80de00feb4c237b24193fa947abe00
MD5 ab3d2998bf14b0fd16c854fa1af3fc06
BLAKE2b-256 d4cdcd4fec0e7cf44c7bc7effd9745645af30edc38b3d96a1c3ae1c1f667ac3f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.12-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.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9f15d7f4754d0d0214ee3c1e4d4477f2d645f7989c632959461b868f29983e20
MD5 58a7d7c0a5e8109a3d0187518a070a0d
BLAKE2b-256 17eb0e1f460d9043b1eb5b0780117695d727ccb16efc61d0875ab76c0aef6e87

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 03558cca3660eac9eed864c5438b8a75e66c1a530160078efc7dc79bcaeb2ffa
MD5 4c65a2670652dac3d0723e5c517a1e58
BLAKE2b-256 36c9cf4af472fa2a51c95755cae129a14dc4d120c9072557947350282e697a00

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rygex-0.1.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 873.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.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5834b0f2897bb073ae084f9c78a44d167aab5bfc26958bfbbc6489e3f6e7063e
MD5 6195e7af83adee6608e5ae1922c286e0
BLAKE2b-256 0bc868eebbfa955d9b5eeea39512e91f019783c8de248cec2a60908668a5d180

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rygex-0.1.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 057475c74393af0a83d43399f0b3c91b81b3188ee49b6ae7dad212c638b31ab8
MD5 ed48bd001875fa8aa284793af188c652
BLAKE2b-256 e11c7b33fb7838c945ef5813991ae56f09a6db327c219001861e4fee353cc4b0

See more details on using hashes here.

Provenance

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