datasette-enrichments-jinja by datasette

42 downloads this week        Star

README source code

datasette-enrichments-jinja

PyPI Changelog Tests License

Datasette enrichment for evaluating templates in a Jinja sandbox

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-enrichments-jinja

Usage

This enrichment allows you to select rows from a table and specify a Jinja template to use to generate new text for each of those rows.

The text can then be saved to a new or existing column on the table.

Code runs in a Jinja sandbox. This should protect against innocent mistakes, but may not be robust against malicious attackers - so only make this enrichment available to users who you trust not to abuse it.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-enrichments-jinja
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest