Pin databases, tables, queries, and more to the Datasette homepage!
datasette-pins requires a recent 1.0 alpha version of Datasette to work.
pip install datasette>=1.0a13Afterwards, install this plugin in the same environment as Datasette.
datasette install datasette-pinsdatasette-pins stores pins in the internal database. This database runs in-memory by default, which means your pins will be lost if you restart the server. To avoid that, start Datasette with the --internal option to specify where that database should be stored on disk:
datasette mydatabase.db --internal internal.dbdatasette-pins has two permissions datasette-pins-write and
datasette-pins-read. Actors with the datasette-pins-write permissions can
pin and reorder items, while actors with datasette-pins-read permissions can
only view pinned items.
Here's an example
datasette.yaml file
where all actors can view pins, but only the root actor can pin items:
permissions:
datasette-pins-read:
id: "*"
unauthenticated: true
datasette-pins-write:
id: "root"Once logged in, the root use will see new pin/unpin option under the database,
table, and query actions menu:
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-pins
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'To run the tests:
pytestThis plugin includes TypeScript/TSX source files in datasette_pins/frontend/ that need to be compiled to JavaScript. If you modify any .ts or .tsx files, you'll need to rebuild the JavaScript.
First install the Node.js dependencies:
npm installThen build the JavaScript using just:
just jsThis uses esbuild to compile and minify the TypeScript files into datasette_pins/static/.

