datasette-ripgrep
Web interface for searching your code using ripgrep, built as a Datasette plugin
For background on this project see datasette-ripgrep: deploy a regular expression search engine for your source code.
Demo
Try this plugin out at https://ripgrep.datasette.io/-/ripgrep - where you can run regular expression searches across the source code of Datasette and all of the datasette-* plugins belonging to the simonw GitHub user.
Some example searches:
- with.*AsyncClient - regular expression search for
with.*AsyncClient - .plugin_config, literal=on - a non-regular expression search for
.plugin_config( - with.*AsyncClient glob=datasette/** - search for that pattern only within the
datasette/top folder - "sqlite-utils[">] glob=setup.py - a regular expression search for packages that depend on either
sqlite-utilsorsqlite-utils>=some-version - test glob=!*.html - search for the string
testbut exclude results in HTML files
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-ripgrep
The rg executable needs to be installed such that it can be run by this tool.
Usage
This plugin requires configuration: it needs to a path setting so that it knows where to run searches.
Create a metadata.json file that looks like this:
{
"plugins": {
"datasette-ripgrep": {
"path": "/path/to/your/files"
}
}
}
Now run Datasette using datasette -m metadata.json. The plugin will add an interface at /-/ripgrep for running searches.
Plugin configuration
The "path" configuration is required. Optional extra configuration options are:
time_limit- floating point number. Thergprocess will be terminated if it takes longer than this limit. The default is one second,1.0.max_lines- integer. Thergprocess will be terminated if it returns more than this number of lines. The default is2000.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-ripgrep
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Metadata
Release files for datasette-ripgrep 0.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datasette-ripgrep-0.8.2.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datasette_ripgrep-0.8.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / datasette-ripgrep-0.8.2.tar.gz
| Download URL | datasette-ripgrep-0.8.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a785627b08f6288f10f0f94dcfe5c40502b6b5614f8fd844f824236e165f3bdf
|
|
BLAKE2b-256 checksum How to use checksums |
af789673d5fa9464e8fbcef3d9fde53d0d0025dc69e0a5f889efa7a549d3d8d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / datasette_ripgrep-0.8.2-py3-none-any.whl
| Download URL | datasette_ripgrep-0.8.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7696c6806cc5a45597cbab5fcb0d3f180f080b4ffb46d09a634d48079d28d5f1
|
|
BLAKE2b-256 checksum How to use checksums |
fba43e208df7d24b0ab9423f9dacc581ce2332e06a55c7394e66a3de0d6911f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|