datasette-llms-txt
This plugin generates llms.txt documentation for a Datasette instance. Large language models and people can then find out which data is available and how to query it.
The plugin reads the schema of your databases when a request arrives. You do not build or update any files. It serves Markdown that lists every database, table, column, and primary key. It also gives the JSON and SQL endpoints that query the data. If you write descriptions in Datasette metadata, the plugin uses them without change.
Installation
Install this plugin in the same environment as Datasette:
datasette install datasette-llms-txt
Usage
After you install the plugin, it adds these endpoints:
| URL | Contents |
|---|---|
/llms.txt |
Instance overview: every database and table, with links and query instructions |
/<db>.md |
A single database and its tables |
/<db>/<table>.md |
Full schema, columns, primary keys, query endpoints and sample rows for one table |
The llms.txt convention asks the index to link to the
markdown (.md) version of each page. The /llms.txt index links to the .md
files above.
The plugin also keeps the earlier /<db>/llms.txt and /<db>/<table>/llms.txt
endpoints. They serve the same content as the .md files.
For example, with a demo.db file:
datasette demo.db
curl http://127.0.0.1:8001/llms.txt
curl http://127.0.0.1:8001/demo.md
curl http://127.0.0.1:8001/demo/people.md
The plugin also adds a link to /llms.txt in Datasette's top-right menu.
Downloading data
Each per-table page also shows how to download the data, not only how to query it:
- CSV export:
/<db>/<table>.csv - Full table, streamed:
/<db>/<table>.csv?_stream=on— every row, no row limit - Full table as JSON: request
/<db>/<table>.json?_size=max, then follow thenext_urlfield in each response - Whole database file:
/<db>.db— the plugin shows this only when the database is immutable and theallow_downloadsetting is on
The plugin shows the streamed-CSV and database-file options only when the
Datasette settings allow_csv_stream and allow_download permit them. Because of
this, the generated docs never link to an endpoint that returns a 403 error.
Metadata
The plugin prefers descriptions from your Datasette
metadata over text that it
builds from the schema. It shows the instance title and description, the
per-database and per-table description, the per-column descriptions, and the
source and license.
A table's description has two uses. It becomes the summary line for that table
in the index and the per-database listings. It also becomes the blockquote at the
top of the table's own llms.txt. If you do not give a description, the plugin
generates a summary like "N rows, columns: …". For example:
title: My Data
description: Public records, refreshed nightly.
source: Example Org
source_url: https://example.com
databases:
demo:
tables:
people:
description: One row per registered person.
columns:
email: Primary contact address.
Configuration
Set the options under the plugin's key in your metadata or config file:
plugins:
datasette-llms-txt:
sample_rows: 5
sample_rows(default5) — the number of example rows to show in each per-tablellms.txt. Set it to0to leave out all sample data. This helps when the rows are sensitive.
Development
cd datasette-llms-txt
uv venv
uv pip install -e '.[test]'
uv run pytest
Or use the Makefile: make install then make test.
Datasette compatibility
The plugin works on Datasette 0.65 and on Datasette 1.0. Datasette 1.0 changed the metadata methods, so the plugin reads the metadata in a way that supports both versions.
make test runs the suite against both versions:
make test
This command builds one environment for each Datasette version and runs the test suite in each one. It builds the environments one time and then reuses them. The CI workflow runs the same matrix.
Metadata
Release files for datasette-llms-txt 0.3.0
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_llms_txt-0.3.0.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datasette_llms_txt-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / datasette_llms_txt-0.3.0.tar.gz
| Download URL | datasette_llms_txt-0.3.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ef4517895cc10c6f1848ca78508af3aaaeeaa2ff911add2cc3db0784186fdd1
|
|
BLAKE2b-256 checksum How to use checksums |
1462a0c6f804f09b4b2c6a51fd1af7f992c6d6e166496dbb0c499c0b73e63be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / datasette_llms_txt-0.3.0-py3-none-any.whl
| Download URL | datasette_llms_txt-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02242873b697faee3a6743d281995e6b818295f6c09b12917ab3aed0bdfd5b94
|
|
BLAKE2b-256 checksum How to use checksums |
159f4093574d73f4535b67224dcb0ffc786f13d82b2cba3787e7a4fe3c0830f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|