https://github.com/datasette/datasette-pins
Pin databases, tables, and other items to the Datasette homepage
https://github.com/datasette/datasette-pins
Last synced: 3 months ago
JSON representation
Pin databases, tables, and other items to the Datasette homepage
- Host: GitHub
- URL: https://github.com/datasette/datasette-pins
- Owner: datasette
- License: apache-2.0
- Created: 2024-04-10T16:56:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-01T22:15:44.000Z (11 months ago)
- Last Synced: 2025-04-25T07:07:33.441Z (3 months ago)
- Language: Python
- Homepage:
- Size: 92.8 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datasette-pins
[](https://pypi.org/project/datasette-pins/)
[](https://github.com/datasette/datasette-pins/releases)
[](https://github.com/datasette/datasette-pins/actions/workflows/test.yml)
[](https://github.com/datasette/datasette-pins/blob/main/LICENSE)Pin databases, tables, queries, and more to the Datasette homepage!
## Installation
`datasette-pins` requires a recent 1.0 alpha version of Datasette to work.
```bash
pip install datasette>=1.0a13
```
Afterwards, install this plugin in the same environment as Datasette.```bash
datasette install datasette-pins
```## Configuration
`datasette-pins` stores pins in the [internal database](https://docs.datasette.io/en/latest/internals.html#datasette-s-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:
```bash
datasette mydatabase.db --internal internal.db
```
`datasette-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](https://docs.datasette.io/en/latest/configuration.html#datasette-yaml-reference)
where all actors can view pins, but only the `root` actor can pin items:```yaml
permissions:
datasette-pins-read:
id: "*"
unauthenticated: true
datasette-pins-write:
id: "root"
```## Usage
Once logged in, the `root` use will see new pin/unpin option under the database,
table, and query actions menu:
## Development
To set up this plugin locally, first checkout the code. Then create a new
virtual environment:```bash
cd datasette-pins
python3 -m venv venv
source venv/bin/activate
```Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```To run the tests:
```bash
pytest
```