ripgrepy
ripgrepy is a python interface to ripgrep.
It is written to support Python 3.7+ only and is built on ripgrep version 11.0.1
For complete usage and details, refer to the docs at
Instal
Use pip to install
pip install ripgrepy
Requirements
ripgrepy leverages the system ripgrep to run its commands. So either the standalone binary, rg in $PATH or a path to ripgrep needs to be provided.
Usage
Ripgrep is a simple module that allows chaining ripgrep options on top of each other and get the result back. There is a couple of helper methods included to help in parsing, such as the as_dict module which shows all valid matches as a dictionary object.
To instantiate the class, use:
from ripgrepy import Ripgrepy
# The Ripgrepy class takes two arguments. The regex to search for and the folder path to search in
rg = Ripgrepy('he[l]{2}o', '/some/path/to/files')
The syntax for ripgrepy is simliar to that of ripgrep itself.
rg.with_filename().line_number()...run().as_string
# the same can be executed using the rg shorthands
rg.H().n().run().as_string
The above is eqivalent to running
rg --with-filename --line-number "he[l]{2}o" /path/to/some/files
Important run() should always be the last method that is being run followed by one of the output methods. If ripgrep options are placed after run, they will not be part of the command being executed. Refer to Readthedocs for complete documentation. The docs are obtained from ripgreps man pages itself.
Output methods
Output can be obtained using the following three properties
as_dictas_jsonas_string
Not all ripgrep output is compitable with as_dict and as_json output formats
Metadata
Release files for ripgrepy 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ripgrepy-2.2.0.tar.gz | 31.7 kB | Without provenance | Details for ripgrepy-2.2.0.tar.gz |
Release files / ripgrepy-2.2.0.tar.gz
| Download URL | ripgrepy-2.2.0.tar.gz |
|---|---|
| Size | 31.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c43c61384f257660007acd271a5d8e4abe9be0b069c418d091f7299e080ca9d
|
|
BLAKE2b-256 checksum How to use checksums |
808a023e7c432634a6090a26ace319a37a2a73aac8fa6a7bf142fd7b3ec8fd3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for ripgrepy 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.