[](https://travis-ci.com/securisec/ripgrepy)
[](http://ripgrepy.readthedocs.io/en/latest/)
[](https://pypi.org/project/ripgrepy/)
<img src="https://raw.githubusercontent.com/securisec/ripgrepy/master/logo.png" width="150px">
# 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
[Readthedocs](http://ripgrepy.readthedocs.io/en/latest/)
## 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](http://ripgrepy.readthedocs.io/en/latest/) for complete documentation. The docs are obtained from ripgreps man pages itself.
#### Output methods
Output can be obtained using the following three properties
- `as_dict`
- `as_json`
- `as_string`
Not all ripgrep output is compitable with `as_dict` and `as_json` output formats
Raw data
{
"_id": null,
"home_page": "https://github.com/securisec/ripgrepy",
"name": "ripgrepy",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Hapsida @securisec",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/80/8a/023e7c432634a6090a26ace319a37a2a73aac8fa6a7bf142fd7b3ec8fd3b/ripgrepy-2.2.0.tar.gz",
"platform": null,
"description": "[](https://travis-ci.com/securisec/ripgrepy)\n[](http://ripgrepy.readthedocs.io/en/latest/)\n[](https://pypi.org/project/ripgrepy/)\n\n\n<img src=\"https://raw.githubusercontent.com/securisec/ripgrepy/master/logo.png\" width=\"150px\">\n\n# ripgrepy\n\n`ripgrepy` is a python interface to ripgrep. \nIt is written to support Python **3.7+** only and is built on ripgrep version **11.0.1**\n\nFor complete usage and details, refer to the docs at \n\n[Readthedocs](http://ripgrepy.readthedocs.io/en/latest/)\n\n## Instal\nUse pip to install\n```\npip install ripgrepy\n```\n\n## Requirements\n`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. \n\n## Usage\nRipgrep 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.\n\nTo instantiate the class, use:\n```\nfrom ripgrepy import Ripgrepy\n# The Ripgrepy class takes two arguments. The regex to search for and the folder path to search in\n\nrg = Ripgrepy('he[l]{2}o', '/some/path/to/files')\n```\n\nThe syntax for ripgrepy is simliar to that of ripgrep itself. \n```\nrg.with_filename().line_number()...run().as_string\n\n# the same can be executed using the rg shorthands\n\nrg.H().n().run().as_string\n```\nThe above is eqivalent to running \n```\nrg --with-filename --line-number \"he[l]{2}o\" /path/to/some/files\n```\n**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](http://ripgrepy.readthedocs.io/en/latest/) for complete documentation. The docs are obtained from ripgreps man pages itself.\n\n#### Output methods\nOutput can be obtained using the following three properties\n- `as_dict`\n- `as_json`\n- `as_string`\n\nNot all ripgrep output is compitable with `as_dict` and `as_json` output formats\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "2.2.0",
"project_urls": {
"Documentation": "https://ripgrepy.readthedocs.io/",
"Homepage": "https://github.com/securisec/ripgrepy"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "808a023e7c432634a6090a26ace319a37a2a73aac8fa6a7bf142fd7b3ec8fd3b",
"md5": "f69a658d633f1b546bb83826e8c0def8",
"sha256": "4c43c61384f257660007acd271a5d8e4abe9be0b069c418d091f7299e080ca9d"
},
"downloads": -1,
"filename": "ripgrepy-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "f69a658d633f1b546bb83826e8c0def8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31740,
"upload_time": "2025-07-11T01:18:01",
"upload_time_iso_8601": "2025-07-11T01:18:01.662361Z",
"url": "https://files.pythonhosted.org/packages/80/8a/023e7c432634a6090a26ace319a37a2a73aac8fa6a7bf142fd7b3ec8fd3b/ripgrepy-2.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-11 01:18:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "securisec",
"github_project": "ripgrepy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ripgrepy"
}