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 publish. The make publish 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.tar.gz (8.9 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-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datasette_llms_txt-0.1.tar.gz
  • Upload date:
  • Size: 8.9 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.tar.gz
Algorithm Hash digest
SHA256 be1f004dfec9f03866e084049aab9c38790eb1b7dcf4e26fed8d99bb7e92300e
MD5 0f82287305d87f835d9fd0cf73c0c5ff
BLAKE2b-256 52610930d231585ae4ffd2e300276ea2bbffdebe06c0db5eb5e7997ff573d717

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datasette_llms_txt-0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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-py3-none-any.whl
Algorithm Hash digest
SHA256 95d3778418aac956e4b39da5463cb73e386471d4d7d7fb066585bbdfeab6cffe
MD5 94e11b8ba2a62188fdb3f371c7a8c0b3
BLAKE2b-256 037ec4b1831838aaa561beb0a3809c55808d98a2e7aeea0f2468e7625383ebfb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.1

2 files

This release

0.1 This release

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