Metadata-Version: 2.5
Name: quilletcms
Version: 1.0.0
Summary: Python SDK for the Quillet CMS delivery API.
Project-URL: Repository, https://github.com/quilletcms/quillet-py
Project-URL: Documentation, https://github.com/quilletcms/quillet-py#readme
Project-URL: Changelog, https://github.com/quilletcms/quillet-py/blob/main/CHANGELOG.md
License-Expression: MIT
License-File: LICENSE
Keywords: cms,content,django,fastapi,headless-cms,markdown,quillet,starlette
Classifier: Framework :: Django
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Content Management System
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.29.0
Requires-Dist: linkify-it-py>=2.2.0
Requires-Dist: markdown-it-py>=4.3.0
Requires-Dist: mdit-py-plugins>=0.7.0
Requires-Dist: nh3>=0.3.8
Provides-Extra: django
Requires-Dist: django>=5.2; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: starlette>=1.10.0; extra == 'fastapi'
Description-Content-Type: text/markdown

# quilletcms

The Python read client for [Quillet](https://github.com/quilletcms/quillet-cms)'s delivery API.
It fetches published content, keeps private files behind your own server, and renders
`{{ variables }}` and Markdown to safe HTML, from sync code (classic Django views, management
commands, templates) and from async code (FastAPI, async Django views) alike. It is the Python
sibling of the JavaScript SDK, [`@quilletcms/sdk`](https://github.com/quilletcms/quillet-js), and
reads the same configuration file and environment variables.

## Install

```bash
pip install quilletcms
```

Python 3.11 or later. The core needs no web framework. `quilletcms.django` needs Django 5.2 or
later (`pip install "quilletcms[django]"`), and `quilletcms.fastapi` needs Starlette or FastAPI
(`pip install "quilletcms[fastapi]"`, which installs Starlette).

## Configure

Non-secret settings live in `.quilletrc` (JSON, safe to commit) at your project root:

```json
{ "apiUrl": "https://cms.example.com", "project": "marketing-site", "assets": { "path": "/media" } }
```

The key id and secret come from environment variables or from code — a `key` in the config file
is refused. The environment is `QUILLET_ENV`, which overrides an `env` the file may carry as a
local default:

```bash
QUILLET_ENV=prod
QUILLET_KEY_ID=app_…        # a delivery key from the Keys page
QUILLET_KEY_SECRET=…
```

The file keeps the camelCase keys it shares with the JavaScript SDK and the Quillet CLI. Every
setting: `apiUrl`, `project`, `env`, `locale`, `refs` (0–5, default 3), `cache.ttl` (seconds,
default 0 = revalidate every read), `assets.mode` (`proxy` | `signed`), `assets.path` (`/media`),
`assets.proxyPublic` (`false`), `assets.maxAge` (300), `retry.attempts` (2). Any string may hold
`${VAR}`, read from the environment. An unknown key is refused; the CLI's own `sync` key is
accepted and left alone. The file is `QUILLET_CONFIG` (a path, which must exist) when that is
set, else the first `.quilletrc` or `.quilletrc.json` found walking up from the working
directory. The environment variables `QUILLET_API_URL`, `QUILLET_PROJECT`, `QUILLET_ENV`,
`QUILLET_LOCALE`, `QUILLET_KEY_ID` and `QUILLET_KEY_SECRET` are read too.

In Python the same settings are snake_case keyword arguments. **Code overrides the environment,
the environment overrides the file, the file overrides the defaults**:

```python
from quilletcms import AsyncQuillet, Quillet

site = Quillet()  # the file and the environment
staging = Quillet(env="staging", cache_ttl=60)  # code wins
proxied = Quillet(assets={"proxy_public": True})  # assets: mode, path, proxy_public, max_age
german = AsyncQuillet(locale="de-DE", retry_attempts=0)
```

The keywords are `api_url`, `project`, `env`, `locale`, `refs`, `key_id`, `key_secret`,
`cache_ttl`, `assets` and `retry_attempts`. An `assets=` mapping is merged over the file's asset
settings field by field; an `AssetsConfig` replaces them all. The values are validated together,
and every problem is reported in one `ConfigError`; an invalid `api_url` is never echoed back,
since a mistyped `${…}` could have made it a secret. A problem with the file itself — it cannot
be read, is not a JSON object, holds a `key` or an unknown key, or names a `${VAR}` that is unset
or refused — stops the reading at once and is reported alone.

The secret is kept out of sight:

- The file may not hold a `key`, and may not substitute `${QUILLET_KEY_ID}`,
  `${QUILLET_KEY_SECRET}` or `${QUILLET_MANAGEMENT_KEY}`: credentials are read from the
  environment (or your code) directly.
- The resolved configuration is a frozen dataclass, `client.config`. Its `repr` leaves out
  `key_secret`, and `client.config.public_dict()` is every setting but the secret, as plain values —
  use that to log or show a configuration. `dataclasses.asdict(client.config)` **includes** the
  secret.
- No error message, `details` or log line carries the secret: it is redacted from what the API
  answers.

A client owns an `httpx` client. Create one per process (an `AsyncQuillet` per event loop) and
reuse it; `close()` / `await aclose()`, or `with` / `async with`, releases it. Pass your own
`httpx.Client` / `httpx.AsyncClient` as `http_client=` for timeouts, proxies or a test transport;
the SDK then leaves it open. `Quillet.from_config(load_config(...))` builds a client from a
configuration resolved beforehand.

## Read

Create the clients once, at module level, and reuse them; the samples below use these two:

```python
from quilletcms import AsyncQuillet, Quillet

q = Quillet()
aq = AsyncQuillet()

hero = q.get("landing/hero", locale="de-DE", vars={"user_name": "Ada"})
nav = q.list("docs/", depth=2)
tree = q.tree("docs/")
for entry in q.walk("docs/"):
    print(entry.item.title, entry.document.content)  # build a page per document
```

The async client has the same methods with the same arguments. Its reads — `get`, `list`,
`search`, `lake`, `tree` — are coroutines, and `walk` is an async iterator; `render_markdown`,
`invalidate` and the `assets` helpers are plain calls on both clients:

```python
async def pages() -> None:
    hero = await aq.get("landing/hero")
    async for entry in aq.walk("docs/"):
        print(entry.item.key, entry.document.meta.version)
```

A client used for one job only can be closed when it is done:

```python
with Quillet() as once:
    print(once.get("landing/hero").meta.version)
```

`get` returns a `Document`: `key`, `locale`, `type`, `content` and `meta`. `content` is the body
exactly as the CMS sent it — a `dict`, `list` or `str` — so a template reads
`{{ doc.content.title }}` without help. `meta` is the API's `_meta` under a name a Django
template can reach: `resolved_locale` (which locale answered), `fallback_locale` and `fallbacks`
(what fell back to it), `version`, `published_at`, `content_hash`, `refs` and `refs_truncated`
(the references followed), `assets` and `assets_truncated` (the assets reached), and `preview`.
Timestamps stay the ISO strings the API sent.

`get` takes `locale`, `at` (a timezone-aware `datetime`, sent as UTC, or a string), `preview`,
`refs` (how many levels of references to follow, 0–5), `vars` and `missing`. `locale` and `refs`
default to the configuration.

`list` returns a `Listing` of items without bodies — `prefix`, `locale`, `folder`, `folders`,
`items` — one level below the prefix unless you give it a `depth`; it takes `locale`, `at`,
`preview`, `depth` and `tags`. `walk` fetches every document under a prefix at any depth, four at
a time (`concurrency=`), and yields a `WalkEntry` of `item` and `document` in listing order; give
it a `depth` to stop sooner. It takes the `list` options plus `refs`, `concurrency`, `vars` and
`missing`, and an error is raised at the entry it belongs to. `tree` nests a prefix's folders and
items into a `FolderNode` (`path`, `title`, `description`, `order`, `items`, `children`); like
`walk` it covers the whole subtree unless you give it a `depth`, and every node's `path` is free
of a trailing slash — `tree("docs/")` answers `docs`, `tree("")` answers `""`. Children sort by
`order` (a folder with none last), then by path.

A key, prefix or lake name is checked against the CMS's grammar before any request is spent; a
bad one raises a `QuilletError` with `code` `invalid_key`, `invalid_prefix` or
`invalid_lake_name`. The grammars are exported as `KEY_PATTERN`, `PREFIX_PATTERN` and
`LAKE_NAME_PATTERN`.

Each client keeps an in-memory cache of up to 1000 answers, one per request URL. With
`cache_ttl` 0 every read revalidates with `If-None-Match`, and a `304` is answered from the
cache; with a `cache_ttl` an answer younger than that is served without a request. Reads with
`at` or `preview` are never cached, and `vars` are applied after the cache, so your values never
enter it. Every value you are handed is your own copy. `q.invalidate(key)` drops one key (and
every cached lake), `q.invalidate()` everything; `cache=None` turns the cache off. Answers `429`
and `503` are retried `retry_attempts` times, waiting `Retry-After` when sent, else 250 ms
doubling, capped at five seconds.

## Search

```python
answer = q.search("promotion", prefix="docs/", tags=["guide"], limit=5)
for hit in answer.hits:
    href = f"/{hit.key}#{hit.anchor}" if hit.anchor else f"/{hit.key}"
```

`search` asks one environment's **published** content. `q` is required, 1 to 200 characters,
and Mongo's own grammar works inside it — `"a phrase"` and `-excluded`. There is no fuzzy
matching and no prefix matching: `promot` does not find _promotion_. The options are `locale`
(the configured one by default), `prefix` (slash-terminated, and checked before any request),
`tags` (a document must carry every one), `limit` (1–50, 10 by default) and `offset` (0-based).
There is no `at` and no `preview`: the API refuses both.

The answer is a `SearchResult` of `hits`, `total` and `meta` (`q`, `locale`, `limit`, `offset`).
A `SearchHit` names the document (`key`, `title`), the `heading` the answer was found under and
that heading's `anchor`, the fragment to append to the page's URL. `heading` and `anchor` are
`None` **together**, on a hit about the page as a whole. `snippet` is plain text with no markup
at all: mark the terms yourself. `score` is comparable within one answer and meaningless across
two — sort by it, but do not threshold on it. `locale` is the locale the text was written in, and
`fallback_locale` is set only where the key had nothing in the locale you asked for and the
project's default answered instead.

Paging stops at the first 200 results: `offset + limit` may not exceed 200, and `total` is the
size of that window rather than of the whole match set. An answer is cached like a listing. A
project with search turned off answers **404**, which arrives as a `NotFoundError`.

## Data lakes

```python
copy = q.lake("site", locale="uk-UA", vars={"name": "Ada"})
copy.fields["done"]  # "Готово"
copy.fields["errors"]["card-declined"]  # "Картку відхилено"
copy.fields["page"]["home"]["title"]  # "Вітаємо, Ada!"
copy.meta.fields["errors.card-declined"]  # LakeFieldMeta(key='errors/card-declined', ...)

errors = copy.fields["errors"]  # a branch is a plain dict: hand it to the template that shows it
```

A data lake is a named set of copies the CMS serves as one file, in the locale asked for, falling
back field by field to the default. A lake's field is a path — dotted segments, prefilled from
the copy's key (`errors/card-declined` → `errors.card-declined`). `fields` is the nested
dictionary those paths make: a group is a dict holding its own paths, a leaf what `get` would
answer as `content` with `refs=0` (a string for `text` and `md`, the merged object for `json`),
or `None` when its copy has nothing published there or in the default locale, or does not exist.
Segments keep the key's spelling (`card-declined`). A lake whose paths are all one segment is the
flat dict it always was. The order of the fields carries no meaning.

`meta.fields` stays flat, keyed by the full path. A path present there is a copy, which is how a
site tells a `json` copy from a group; `missing` is `True` for a `None` leaf.
`meta.assets[]["path"]` runs through the groups (`page.home.hero.image`).

`vars` and asset URLs apply at every depth; a missing variable is reported against
`_lakes/<name>` at its full path (`errors.card-declined`).

Options are `locale` (the configured one by default), `vars` and `missing`, which apply to every
string of every field as they do in `get`. There is no `at`, `preview` or `refs`. The name is one
key segment, checked before any request. A lake is cached like a document, and
`q.invalidate(key)` drops every cached lake as well as `key`, since any copy may sit in any lake.

## Preview drafts

`get`, `list`, `tree` and `walk` all take a `preview` token, minted by the Quillet dashboard's
**Preview on website** button for one document, locale and fifteen minutes. A site's own preview
route receives the token as a query parameter, uses it to read the one document it names, and —
once it has checked the request is genuinely the reader who was sent it — keeps it in a cookie
for the length of the visit:

```python
draft = q.get("docs/intro", locale="en-US", preview=token)
draft.meta.preview  # True
```

A preview read is never cached. `list` and `walk` pass the token to every request they make, so
an unpublished document under a listed prefix appears in a walk's results, with
`meta.published_at` `None` if it has never been published. Passing `at` and `preview` together
is refused by the CMS with 422; the SDK forwards what it is given. Minting and verifying a token
is the CMS's and your preview route's concern — this package only carries the string. Hold it no
longer than the preview needs, in an httpOnly cookie your route controls.

## Private files

Every asset in a document's `content` arrives as the dictionary the API delivered, with `url`
(what to render) and `originUrl` (what the API answered) — the wire's spelling, since it sits
among wire fields. By default a private file's `url` points at your own site, `/media/<id>`, and
you mount the proxy there. A public file's `url` stays the CMS's own delivery URL; set
`assets.proxyPublic` (`proxy_public=True` in code) to serve public files through your host as
well, so every image is same-origin. Set `assets.mode` to `signed` to skip the proxy: `url` is
then the API's own signed URL. A private file the delivery key may not read arrives with `url`
(and `originUrl`) `None`; `asset_url` then answers `None` and `srcset` answers `""`.

```python
from quilletcms import asset_url, signed_url, srcset

image = hero.content["image"]
asset_url(image, w=640, f="webp")  # url with ?w=640&f=webp
srcset(image)  # "<url>?w=320 320w, <url>?w=640 640w, …"
signed_url(image)  # originUrl: the API's own URL, signed for a private file
q.assets.srcset(image, widths=[320, 640], format="webp")
```

The proxy streams bytes from Quillet with your delivery key, so the reader never sees Quillet's
host or a token; the delivery key must hold the `assets:private` scope. It answers `GET` and
`HEAD`; passes `w` and `f` through, and `Range`, `If-None-Match` and `If-Range`; answers 200,
206, 304 and 416 with an allow-list of the upstream's headers; turns 401, 403 and 404 into a bare
404, so a reader cannot tell "no right to it" from "no such file"; and answers anything else with
a 502, logged once per status through the `quilletcms` logger. `Cache-Control` is the upstream's
when public, else `private, max-age=<assets.maxAge>`. A malformed id answers 404 without asking
the CMS.

**Who may see a private file is your site's decision**: check the reader's session before the
proxy runs — a FastAPI dependency, a Django decorator.

One prerequisite on the CMS side: proxying a _private_ file needs a Quillet CMS at or after
[quilletcms/quillet-cms#5](https://github.com/quilletcms/quillet-cms/pull/5), which lets the
bytes route open a private file for a delivery key holding `assets:private`. On an older CMS a
private file answers 404 through the proxy, and `assets.mode: "signed"` is the option that works
there.

### FastAPI and Starlette

```python
from fastapi import FastAPI
from quilletcms import AsyncQuillet
from quilletcms.fastapi import asset_route

aq = AsyncQuillet()
app = FastAPI()
app.add_api_route("/media/{asset_id}", asset_route(aq), methods=["GET", "HEAD"])
```

`asset_route(client)` returns an async endpoint that takes a Starlette `Request`. A file is
streamed; the answers without a body (`HEAD`, 304, 404, 405, 502) are plain responses. It needs
an `AsyncQuillet`, so the event loop is never blocked; given a `Quillet` it raises `TypeError`
when the route is made. Registered
with `methods=["GET", "HEAD"]`, other methods get the router's own 405. It uses only Starlette,
so it mounts in a plain Starlette app too:
`Route("/media/{asset_id}", asset_route(aq), methods=["GET", "HEAD"])`. Guard it with your own
dependency (`dependencies=[Depends(...)]`).

### Django

```python
# urls.py
from django.urls import path
from quilletcms.django import asset_view

urlpatterns = [path("media/<str:asset_id>", asset_view())]
```

`asset_view(client=None)` returns a view `(request, asset_id)` that serves the file, and 405 to
anything but `GET` and `HEAD`; the answers without a body (`HEAD`, 304, 404, 405, 502) are plain
`HttpResponse`s. Wrap it in your own decorator (`login_required`, a permission
check) to decide who may read.

`asset_view()` with no argument is an **async** view, using `get_async_client()`, and it streams
the file under ASGI. Under WSGI, including `manage.py runserver`, it still serves the file but
reads it into memory first. **To stream on a WSGI deployment, pass the sync client**,
`asset_view(get_client())`, which makes a sync view. `asset_view(aq)` with your own
`AsyncQuillet` is an async view over that client.

```python
# urls.py, on a WSGI server
from django.urls import path
from quilletcms.django import asset_view, get_client

urlpatterns = [path("media/<str:asset_id>", asset_view(get_client()))]
```

`quilletcms.django.get_client()` is one sync `Quillet` per process, built on first use from an
optional `QUILLET` dictionary in your Django settings — the snake_case keywords above — on top of
the file and the environment. `get_async_client()` builds an `AsyncQuillet` the same way and keeps
one **per running event loop**, since an `httpx.AsyncClient` cannot be shared across loops.

```python
# settings.py
QUILLET = {"locale": "en-US", "cache_ttl": 60}
```

## Variables and Markdown

```python
from quilletcms import heading_slug, heading_slugs, interpolate, render_markdown

interpolate("hello {{ user_name }}!", {"user_name": "Ada"})  # hello Ada!
render_markdown(doc.content)  # HTML, sanitised
render_markdown(doc.content, heading_ids=True)  # <h2 id="promoting-an-environment">
heading_slug("Promoting an Environment")  # promoting-an-environment
```

`{{ name }}` and `{{ a.b }}`, nothing else; `\{{` is a literal `{{`. A missing variable is kept as
written, or pass `missing="empty"` or `missing="throw"` (a `MissingVariableError`). `get`, `walk`
and `lake` take `vars` and apply them to every string of the body, at any depth, never to an
asset's fields; `apply_vars(document, vars)` does the same to a `Document` you hold. A boolean is
written `true` / `false` and a number as JavaScript's `String(n)` writes it (`2.0` is `2`, `1e-7`
is `1e-7`), so one document renders the same from either SDK.

**A variable's value is inserted as-is into every string of the body, richtext HTML fields
included, so escape anything a reader can influence before you pass it as a variable.**

`render_markdown(text, *, allow_html=False, heading_ids=False, resolve_asset_url=None)` is a plain
synchronous function: CommonMark with tables, strikethrough, task lists, autolinked URLs and
footnotes. By default raw HTML in the source is removed — not escaped, not kept — and the output
is sanitised with GitHub's allow-list. **`allow_html=True` turns sanitising off entirely** — raw
HTML in the Markdown reaches the page as written, script tags included — so pass it only for
content you trust, never for anything a reader, an untrusted editor or a variable's value can
influence.

`render_markdown` emits **no heading ids by default**. `heading_ids=True` puts an `id` on every
top-level `h2` and `h3` — an `h1` is the page, and its anchor is the document — using
`heading_slug`, which is the same algorithm the CMS indexes with: a search hit's `anchor` and the
`id` on the page are the same string. Only top-level headings get an id, the same headings the
CMS indexes as sections, so one quoted in a blockquote or nested in a list item is left alone.
`heading_slugs` is the pass over one document's headings in order, suffixing repeats `x`, `x-1`,
`x-2`; call it yourself to build a table of contents beside the HTML. The text an id is slugged
from is the heading's Markdown text as the CMS reads it: a footnote reference and image alt text
contribute nothing, and raw HTML in a heading contributes its own characters. With
`allow_html=True` the ids are written on the Markdown headings themselves; a heading written in
raw HTML (`<h2>…</h2>`) gets none.

Ids are the bare slug — letters, digits and hyphens, never a caller's string. A heading id can
shadow a same-named global in the page's own scripts, so if your scripts read bare globals off
`window`, name them out of a heading's way.

### Images in Markdown

A Markdown body writes an asset as `/d/v1/<slug>/assets/<id>` — a path with no origin, because
the CMS does not know which host will render it. `resolve_asset_url` says what those become: it
is handed `{"id": ..., "path": ...}` for every such reference in an image, a link or a link
definition, and its answer replaces the path, keeping any `?w=` or `?f=` query. Absolute URLs and
every other path are left exactly as written.

```python
from quilletcms import render_markdown

q.render_markdown(doc.content)  # the client's own resolver, already filled in
render_markdown(doc.content, resolve_asset_url=q.assets.resolve_markdown_url)
```

`assets.proxyPublic` decides what that resolver answers. Set, a reference becomes your own
`<assets.path>/<id>`; unset — and in `signed` mode — it becomes the path against the CMS the
client reads from. Nothing is signed: a private asset is refused in a Markdown body at save, so
every reference is to a public file. An option you pass to `q.render_markdown` yourself wins,
`resolve_asset_url` included.

## Django templates

Add the app, then `{% load quillet %}`:

```python
# settings.py
INSTALLED_APPS = [
    # ...
    "quilletcms.django",
]
```

```django
{% load quillet %}
{{ doc.content.body|quillet_markdown }}
<img src="{{ doc.content.image|quillet_url:640 }}" srcset="{{ doc.content.image|quillet_srcset }}">
```

- `quillet_markdown` renders Markdown with `get_client().render_markdown(..., heading_ids=True)`
  and marks it safe; `None` or `""` renders nothing.
- `quillet_srcset` is `srcset(asset)`.
- `quillet_url:<width>` is `asset_url(asset, w=width)`, and `""` for an asset with no `url`.

## Errors

Every error from a read or from the configuration is a `QuilletError` with `status`, `code` and
`details`; the errors pickle and copy with every attribute. The one exception is set-up code:
`asset_route(...)` given a sync client raises `TypeError` when the route is made.

| Class | When |
|---|---|
| `NotFoundError` | the API answered 404 |
| `UnauthorizedError` | 401 or 403 |
| `RateLimitedError` | 429, after the retries; `retry_after` is the `Retry-After` header in seconds, or 0 |
| `NetworkError` | no answer at all (`status` 0); the message names the origin only |
| `ConfigError` | the configuration is unusable; `details["problems"]` always lists the problems; `details["file"]` names the file, or is `None` when no config file was found |
| `MissingVariableError` | `missing="throw"` met an unset variable; `variable`, `key`, `path` say which and where |

`code` is the API's error code (`http_<status>` when it sent none). Any other non-2xx answer is a
plain `QuilletError`, and so is a 2xx whose body is not a JSON object, or not the shape the route
answers (`code` `invalid_response`); such a body is never cached.
Arguments refused before any request are plain `QuilletError`s with `status` 0: a bad key, prefix
or lake name (`invalid_key`, `invalid_prefix`, `invalid_lake_name`) and an `at` without a time
zone (`invalid_at`). Configuration values are validated together and reported in one
`ConfigError`; a problem with the file itself is reported alone, as soon as it is met.

```python
from quilletcms import NotFoundError

try:
    page = q.get("docs/missing")
except NotFoundError:
    page = None
```

## Differences from the JavaScript SDK

- Names are snake_case: `get(..., locale=...)`, `meta.resolved_locale`, `fallback_locale`.
  `Document.meta` is the wire's `_meta`. An asset's `originUrl` keeps its wire spelling.
- There are two clients, `Quillet` and `AsyncQuillet`, rather than one async client.
- No type generation: `content` and lake `fields` are plain JSON values.
- No module config files: `quillet.config.{js,mjs,ts}` are JavaScript; only `.quilletrc` and
  `.quilletrc.json` are read.
- No Next.js adapter; the asset proxy mounts in FastAPI, Starlette and Django instead.
- `tree` sorts sibling paths with no `order` by code point, where the JavaScript SDK uses
  `localeCompare`. The two can differ only between names that differ at `.`, `_` or `-`.
- `render_markdown`'s HTML is not byte-identical with `renderMarkdown`'s: the same features, the
  same sanitising policy and the same heading ids, not the same whitespace or attribute order.
  Footnote ids are `fn1` / `fnref1` rather than `user-content-fn-1`.
- A `w` or `f` query parameter repeated on a proxied request takes the last value.
- An `invalidate()` that races an in-flight revalidation of the same URL does not stick for that
  URL: the revalidation's answer is stored after it.

## Development

```bash
uv sync --locked
uv run ruff check . && uv run ruff format --check . && uv run pyright
uv run pytest   # set QUILLET_SMOKE_URL/_PROJECT/_ENV/_KEY_ID/_KEY_SECRET to run the smoke suite too
```

A release is published from a tag by the `publish` workflow, run by hand:
`gh workflow run publish.yml -f tag=v1.0.0`. It checks that the tag is `v` plus the version in
`pyproject.toml`, runs the checks and builds in one job, and publishes the built files to PyPI
through trusted publishing in a second job that does nothing else.

## Changelog

See [CHANGELOG.md](https://github.com/quilletcms/quillet-py/blob/main/CHANGELOG.md).

## Licence

MIT.
