datasette-ripgrep


Namedatasette-ripgrep JSON
Version 0.8.2 PyPI version JSON
download
home_pagehttps://github.com/simonw/datasette-ripgrep
SummaryWeb interface for searching your code using ripgrep, built as a Datasette plugin
upload_time2023-10-25 00:10:47
maintainer
docs_urlNone
authorSimon Willison
requires_python>=3.7
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datasette-ripgrep

[![PyPI](https://img.shields.io/pypi/v/datasette-ripgrep.svg)](https://pypi.org/project/datasette-ripgrep/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-ripgrep?include_prereleases&label=changelog)](https://github.com/simonw/datasette-ripgrep/releases)
[![Tests](https://github.com/simonw/datasette-ripgrep/workflows/Test/badge.svg)](https://github.com/simonw/datasette-ripgrep/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-ripgrep/blob/main/LICENSE)

Web interface for searching your code using [ripgrep](https://github.com/BurntSushi/ripgrep), built as a [Datasette](https://datasette.io/) plugin

For background on this project see [datasette-ripgrep: deploy a regular expression search engine for your source code](https://simonwillison.net/2020/Nov/28/datasette-ripgrep/).

## 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](https://github.com/simonw).

Some example searches:

- [with.\*AsyncClient](https://ripgrep.datasette.io/-/ripgrep?pattern=with.*AsyncClient) - regular expression search for `with.*AsyncClient`
- [.plugin_config, literal=on](https://ripgrep.datasette.io/-/ripgrep?pattern=.plugin_config\(&literal=on) - a non-regular expression search for `.plugin_config(`
- [with.\*AsyncClient glob=datasette/\*\*](https://ripgrep.datasette.io/-/ripgrep?pattern=with.*AsyncClient&glob=datasette%2F%2A%2A) - search for that pattern only within the `datasette/` top folder
- ["sqlite-utils\[">\] glob=setup.py](https://ripgrep.datasette.io/-/ripgrep?pattern=%22sqlite-utils%5B%22%3E%5D&glob=setup.py) - a regular expression search for packages that depend on either `sqlite-utils` or `sqlite-utils>=some-version`
- [test glob=!\*.html](https://ripgrep.datasette.io/-/ripgrep?pattern=test&glob=%21*.html) - search for the string `test` but 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](https://github.com/BurntSushi/ripgrep/blob/master/README.md#installation) 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:

```json
{
    "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. The `rg` process will be terminated if it takes longer than this limit. The default is one second, `1.0`.
- `max_lines` - integer. The `rg` process will be terminated if it returns more than this number of lines. The default is `2000`.

## 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/simonw/datasette-ripgrep",
    "name": "datasette-ripgrep",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/af/78/9673d5fa9464e8fbcef3d9fde53d0d0025dc69e0a5f889efa7a549d3d8d2/datasette-ripgrep-0.8.2.tar.gz",
    "platform": null,
    "description": "# datasette-ripgrep\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-ripgrep.svg)](https://pypi.org/project/datasette-ripgrep/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-ripgrep?include_prereleases&label=changelog)](https://github.com/simonw/datasette-ripgrep/releases)\n[![Tests](https://github.com/simonw/datasette-ripgrep/workflows/Test/badge.svg)](https://github.com/simonw/datasette-ripgrep/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-ripgrep/blob/main/LICENSE)\n\nWeb interface for searching your code using [ripgrep](https://github.com/BurntSushi/ripgrep), built as a [Datasette](https://datasette.io/) plugin\n\nFor background on this project see [datasette-ripgrep: deploy a regular expression search engine for your source code](https://simonwillison.net/2020/Nov/28/datasette-ripgrep/).\n\n## Demo\n\nTry 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](https://github.com/simonw).\n\nSome example searches:\n\n- [with.\\*AsyncClient](https://ripgrep.datasette.io/-/ripgrep?pattern=with.*AsyncClient) - regular expression search for `with.*AsyncClient`\n- [.plugin_config, literal=on](https://ripgrep.datasette.io/-/ripgrep?pattern=.plugin_config\\(&literal=on) - a non-regular expression search for `.plugin_config(`\n- [with.\\*AsyncClient glob=datasette/\\*\\*](https://ripgrep.datasette.io/-/ripgrep?pattern=with.*AsyncClient&glob=datasette%2F%2A%2A) - search for that pattern only within the `datasette/` top folder\n- [\"sqlite-utils\\[\">\\] glob=setup.py](https://ripgrep.datasette.io/-/ripgrep?pattern=%22sqlite-utils%5B%22%3E%5D&glob=setup.py) - a regular expression search for packages that depend on either `sqlite-utils` or `sqlite-utils>=some-version`\n- [test glob=!\\*.html](https://ripgrep.datasette.io/-/ripgrep?pattern=test&glob=%21*.html) - search for the string `test` but exclude results in HTML files\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    $ datasette install datasette-ripgrep\n\nThe `rg` executable needs to be [installed](https://github.com/BurntSushi/ripgrep/blob/master/README.md#installation) such that it can be run by this tool.\n\n## Usage\n\nThis plugin requires configuration: it needs to a `path` setting so that it knows where to run searches.\n\nCreate a `metadata.json` file that looks like this:\n\n```json\n{\n    \"plugins\": {\n        \"datasette-ripgrep\": {\n            \"path\": \"/path/to/your/files\"\n        }\n    }\n}\n```\n\nNow run Datasette using `datasette -m metadata.json`. The plugin will add an interface at `/-/ripgrep` for running searches.\n\n## Plugin configuration\n\nThe `\"path\"` configuration is required. Optional extra configuration options are:\n\n- `time_limit` - floating point number. The `rg` process will be terminated if it takes longer than this limit. The default is one second, `1.0`.\n- `max_lines` - integer. The `rg` process will be terminated if it returns more than this number of lines. The default is `2000`.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n    cd datasette-ripgrep\n    python3 -mvenv venv\n    source venv/bin/activate\n\nOr if you are using `pipenv`:\n\n    pipenv shell\n\nNow install the dependencies and tests:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Web interface for searching your code using ripgrep, built as a Datasette plugin",
    "version": "0.8.2",
    "project_urls": {
        "CI": "https://github.com/simonw/datasette-ripgrep/actions",
        "Changelog": "https://github.com/simonw/datasette-ripgrep/releases",
        "Homepage": "https://github.com/simonw/datasette-ripgrep",
        "Issues": "https://github.com/simonw/datasette-ripgrep/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fba43e208df7d24b0ab9423f9dacc581ce2332e06a55c7394e66a3de0d6911f4",
                "md5": "0f9531324d1416d0f052019722f7e782",
                "sha256": "7696c6806cc5a45597cbab5fcb0d3f180f080b4ffb46d09a634d48079d28d5f1"
            },
            "downloads": -1,
            "filename": "datasette_ripgrep-0.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f9531324d1416d0f052019722f7e782",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11169,
            "upload_time": "2023-10-25T00:10:45",
            "upload_time_iso_8601": "2023-10-25T00:10:45.719172Z",
            "url": "https://files.pythonhosted.org/packages/fb/a4/3e208df7d24b0ab9423f9dacc581ce2332e06a55c7394e66a3de0d6911f4/datasette_ripgrep-0.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af789673d5fa9464e8fbcef3d9fde53d0d0025dc69e0a5f889efa7a549d3d8d2",
                "md5": "fffc6794ffe1da2d7289e195d8b2d2b9",
                "sha256": "a785627b08f6288f10f0f94dcfe5c40502b6b5614f8fd844f824236e165f3bdf"
            },
            "downloads": -1,
            "filename": "datasette-ripgrep-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fffc6794ffe1da2d7289e195d8b2d2b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12101,
            "upload_time": "2023-10-25T00:10:47",
            "upload_time_iso_8601": "2023-10-25T00:10:47.326974Z",
            "url": "https://files.pythonhosted.org/packages/af/78/9673d5fa9464e8fbcef3d9fde53d0d0025dc69e0a5f889efa7a549d3d8d2/datasette-ripgrep-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-25 00:10:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "datasette-ripgrep",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datasette-ripgrep"
}
        
Elapsed time: 0.19059s