Skip to main content

datasette-llms-txt

PyPI Tests License

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 three endpoints:

URL Contents
/llms.txt Instance overview: every database and table, with links and query instructions
/<db>/llms.txt A single database and its tables
/<db>/<table>/llms.txt Full schema, columns, primary keys, query endpoints and sample rows for one table

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/llms.txt
curl http://127.0.0.1:8001/demo/people/llms.txt

The plugin also adds a link to /llms.txt in Datasette's top-right menu.

Downloading data

Each per-table llms.txt 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 the next_url field in each response
  • Whole database file: /<db>.db — the plugin shows this only when the database is immutable and the allow_download setting 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 (default 5) — the number of example rows to show in each per-table llms.txt. Set it to 0 to 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.

Publishing

Build a release and upload it to PyPI with uv:

uv build                       # produces dist/*.whl and dist/*.tar.gz
uv publish --token <pypi-token>   # or set UV_PUBLISH_TOKEN

You can also run make build and then make pypi. The make pypi target reads UV_PUBLISH_TOKEN from the environment. It is better to publish with the GitHub Actions publish.yml workflow than to upload by hand. That workflow runs when you publish a GitHub Release, and it uses trusted publishing.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette_llms_txt-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasette_llms_txt-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file datasette_llms_txt-0.1.1.tar.gz.

File metadata

  • Download URL: datasette_llms_txt-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}

File hashes

Hashes for datasette_llms_txt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c2678dda0209373fd1295388981723b78aa4d40f27af1bc42e930aeaa74964e4
MD5 9f8e9ba2a2c204fbc15786bc7ccf2808
BLAKE2b-256 5fc20a3840568508a3bb286540c07a1dcdcadc09f6140f0b3a96f60bc88ecfba

See more details on using hashes here.

File details

Details for the file datasette_llms_txt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: datasette_llms_txt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}

File hashes

Hashes for datasette_llms_txt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02a7ed1fecdfc5342ec80b5366c91eb85cd2960a01b153387d8192f2f33fc1d6
MD5 91242e7fc125cdf8a9f5c49667e66c98
BLAKE2b-256 4e420ea4890a54c824f1dbc677082eeb4d01de06e8f8d4f1f5f3c2f06df177ab

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page