Skip to main content

Quillmark: Python bindings

Python bindings for Quillmark, a schema-driven document framework.

Maintained by birdorbs.

Quillmark is pre-1.0. Its stability statement says what any release can change and what every release keeps.

Installation

pip install quillmark

The package is typed: it ships py.typed and stubs for the whole surface.

Quick Start

from quillmark import Engine, Quill, OutputFormat

engine = Engine()                          # backend registry + render dispatcher
quill = Quill.from_path("path/to/quill")   # a document format, as declarative data

markdown = """~~~
$quill: my_quill
$kind: main
title: Hello World
~~~

# Hello
"""

doc = quill.parse(markdown)
result = engine.render(quill, doc, OutputFormat.PDF)
result.artifacts[0].save("output.pdf")

API surface

Field I/O flows through quill.writer(doc) and quill.reader(doc), the schema-bound writer and reader. Document carries the quill-free surface: parse, storage, structure, $ext / $seed, and remove_field. Names follow snake_case, and the shared model (the Document / Card shapes, Diagnostics, the storage DTO) is identical to @quillmark/wasm's.

Engine

engine = Engine()
engine.registered_backends()              # ['typst', 'acroform'] (order not guaranteed)
engine.render(quill, doc, OutputFormat.PDF)      # ppi=, pages=, regions=, title= optional
                                          # today=datetime.date, default the local date
engine.supported_formats(quill)           # [OutputFormat.PDF, ...] (raises if backend unregistered)

Quill

quill = Quill.from_path("path/to/quill")  # pure config load: no backend resolved here

quill.backend_id            # "typst" (declared backend)
quill.schema                # structured dict of the quill's document schema
quill.authoring_schema      # JSON Schema of the authoring document an LLM writes
quill.metadata              # `name`, `version`, `backend`, `author`, `description`, then `license`, `homepage` when declared
quill.quill_ref             # "name@version"

doc     = quill.parse(markdown)           # parse + conform to the quill's schema, the primary ingestion path
diags   = quill.conform(doc)              # the same walk in place on a transported document ([] = in its stored form)
diags   = quill.validate(doc)             # list of diagnostic dicts ([] = valid): validation::*,
                                          # parse::dropped_construct, backend::declined_construct
empty   = quill.empty_document()          # the empty Document: $quill + $kind: main, nothing committed
doc     = quill.from_authoring(reply)     # an LLM's JSON document, conformed like parse
reply   = quill.to_authoring(doc)         # the document as JSON: rich text as Markdown strings
seed    = quill.seed_document()           # starter Document: one card per kind, each its kind's seed
example = quill.example_document()        # the seed with every declared example committed; None without one
main    = quill.seed_main()               # just the $kind: main card (dict, like doc.main)
card    = quill.seed_card("note")         # one starter composable card (dict), None if kind undeclared

writer  = quill.writer(doc)               # schema-bound typed writer
reader  = quill.reader(doc)               # schema-bound interpreted reader

Writer: quill.writer(doc)

Resolves each field's type from the bound quill, so a name the schema does not declare is a typo (UnknownField), not a fallback. Holds both handles by reference and owns neither: bind, write, discard.

w = quill.writer(doc)
w.set("title", "On Taro")                 # typed-commit one field (mismatch raises now)
w.set_all({"title": "T", "author": "A"})  # atomic batch; one diagnostic per bad field
w.revise("A **taro** essay.")             # body write: no field is the body (edit semantics, anchors ride the diff)
w.revise("make it **bold**", "bio")       # typed *and* anchor-preserving content write (codec by declared type)
w.add_card("quotes", {"author": "Basho"}, "…", at=None)  # make + typed commit + insert (at appends/inserts)
                                          # set and set_all return the parse::dropped_construct
                                          # warnings their markdown raised: [Diagnostic, ...]
                                          # add_card returns {"id", "warnings": [Diagnostic, ...]}
                                          # revise returns its receipt:
                                          # {"delta", "warnings": [Diagnostic, ...], "dropped_anchors": [{"id", "line"}]}
w.revise_document(markdown)               # whole-document write: cards align by $kind and text, anchors ride the diff,
                                          # then conform; returns {"dropped_anchors": [{"id", "path", "line"}],
                                          # "warnings": [Diagnostic, ...], "from": [int | None]}, clears doc.warnings
w.remove_card(0)
w.set("author", "Issa", card=0)           # every verb takes card=: None is main, an int the composable card

Reader: quill.reader(doc)

The read twin of Writer. get reads each field in the values form: every content leaf in its type tree as its codec's text (a richtext leaf to markdown, a text leaf to its literal text), everything else as stored, never coerced. get_content is the same read at the other end of the codec, handing back the field's Content as a dict whichever write stored it.

v = quill.reader(doc)
v.get("bio")                              # richtext → markdown str; scalar → as stored; absent or present-null → None
                                          # undeclared name raises UnknownField; undecodable content raises FieldDecode
v.get_content("bio")                      # the `Content` dict {text, blocks, containers?, marks?, anchors?, islands?, codec?}; absent → None
                                          # a type that is not a content leaf raises FieldNotContent
v.get("author", card=0)                   # a card field, interpreted by its $kind schema
doc.to_markdown_at(card=0)                # a card body's markdown, quill-free
doc.card(0)["kind"]                       # the composable card's $kind

RenderResult / Artifact

result.artifacts            # [Artifact, ...]
result.warnings             # [Diagnostic, ...]: quill.validate's but backend::declined_construct,
                            # then the compile's, backend::declined_construct among them;
                            # the load's stay on doc.warnings
result.format               # OutputFormat

artifact.format             # OutputFormat
artifact.bytes              # bytes
artifact.mime_type          # 'application/pdf', 'image/svg+xml', ...
artifact.save("out.pdf")

Document

doc = Document("my_quill")                       # blank canvas: $quill only, no fields, no cards
doc = Document.parse(markdown)
emitted = doc.to_markdown()

stored   = doc.to_stored()
restored = Document.from_stored(stored)

Document.storage_version_of(blob)                # raw tag, even one this build does not read; None when not a DTO
Document.current_storage_version()               # newest tag this build writes; a row holding no vocabulary the previous tag lacks keeps the previous tag

Document.markdown_rules()                        # Quillmark Markdown rules (static text)
Document.quill_ref_hint()                        # $quill reference grammar (static text)

doc.clone()
doc.equals(other)
doc.card_count
doc.main; doc.cards; doc.warnings                # total-read snapshots (dicts); a card's body is a content dict
doc.card(0)                                      # one card, same dict shape as main (out of range raises)
doc.seed_overlay("note")                         # one $seed[kind] overlay, or None
doc.set_quill_ref("other@1.0")

# Structure (quill-free, a card kind is a name, not a schema fact):
doc.unchecked.insert_card({"kind": "note", "body": "..."}, at=None)   # at appends/inserts; returns the $id
doc.unchecked.insert_card({"kind": "note",                            # fields → payload items
                           "payload_items": [{"type": "field", "key": "x", "value": 1}]})
doc.unchecked.store_field("title", "x", card=None)                    # no schema coercion; content stored canonical
doc.remove_card(0)                               # returns the Card dict, or None
doc.move_card(2, 0)
doc.remove_field("title")                        # remove serves every write path; card=i targets a composable card

# Out-of-band consumer state (never rendered):
doc.store_ext({"agent": {"pinned": True}})       # whole $ext map; card=i for a composable card
doc.store_ext({**doc.main["ext"], "agent": {"n": 1}})   # one namespace: merge, then store
doc.remove_ext()                                 # every namespace at once
doc.store_seed_overlay("note", {"tag": "T"})     # per-kind $seed overlay; new cards spawn with it
doc.remove_seed_overlay("note")

# Comment anchors (the thread lives in the host's store, keyed by the anchor id):
doc.anchor_contexts()                            # [{"id", "path", "quote", "prefix", "suffix"}, ...]
doc.anchor_context("c1")                         # one selector, or None
doc.reattach(selectors, deltas=None)             # re-add dropped anchors where the quote is found once:
                                                 # {"reattached": [...], "orphaned": [...]}

Setting a field's value is the writer's job (quill.writer(doc).set(...)): a field write needs the schema, and Document is quill-free. Reading a field's interpreted value is the reader's (quill.reader(doc).get(...)).

Schema model

A field declares no required: key and an unanswered field draws no diagnostic; default: is what an unanswered field renders.

Error contract

A Quillmark refusal raises QuillmarkError, carrying a non-empty .diagnostics list of Diagnostic objects, the first an error; Error Handling has the shape, the code namespaces and the warnings that follow. An argument the binding cannot read at all — a non-finite float, a value with no JSON form, a malformed path sequence — raises ValueError before core is called, described by no diagnostic.

try:
    Document.parse(bad_md)
except QuillmarkError as exc:
    for d in exc.diagnostics:
        print(d.severity, d.code, d.message, d.path)
        print(str(d))   # canonical pretty-printed text (matches CLI / WASM)

Card and page indices count from the front, so a negative one addresses nothing rather than the last card or page: it takes the same answer as an index past the end — edit::index_out_of_range where the verb raises, None where remove_card answers absence.

Each refusal anchors at a rooted document path: main.<field> for a main field, cards.<kind>[<i>].<field> for a card field, cards[<i>] for a structural out-of-range op.

Changelog

See the changelog and the GitHub Releases page for release notes and version history.

Development

uv venv
source .venv/bin/activate
uv pip install maturin pytest
maturin develop
pytest

maturin develop builds the extension in the debug profile. Stay in the activated venv: uv sync, uv run, and pip install -e each sync the project through maturin's PEP 517 backend, a release build that replaces the debug .so.

python/quillmark/_quillmark.pyi is hand-written and must track src/. No CI job gates it, so after changing the surface run the stub against the built module yourself:

uv pip install mypy
python -m mypy.stubtest --ignore-disjoint-bases quillmark

License

Apache-2.0

Metadata

Release files for quillmark 0.142.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quillmark 0.142.2
File Size Uploaded Provenance Actions
quillmark-0.142.2.tar.gz 2.8 MB With provenance Details for quillmark-0.142.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for quillmark 0.142.2
File Actions
quillmark-0.142.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for quillmark-0.142.2-cp310-abi3-win_amd64.whl
quillmark-0.142.2-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for quillmark-0.142.2-cp310-abi3-musllinux_1_2_x86_64.whl
quillmark-0.142.2-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for quillmark-0.142.2-cp310-abi3-musllinux_1_2_aarch64.whl
quillmark-0.142.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for quillmark-0.142.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
quillmark-0.142.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for quillmark-0.142.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
quillmark-0.142.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for quillmark-0.142.2-cp310-abi3-macosx_11_0_arm64.whl
quillmark-0.142.2-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for quillmark-0.142.2-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 138.3 MB

Release files / quillmark-0.142.2.tar.gz

Download URL quillmark-0.142.2.tar.gz
Size 2.8 MB
Tags Source
SHA-256 checksum
How to use checksums
3511ec21b8b37349fa68da91ea4a8e1005cff45e15a385c85e7094987ab4816e
BLAKE2b-256 checksum
How to use checksums
f509905e1276aca70347bd169d716acd8464f2385ca61cfc64619011bc381a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-win_amd64.whl

Download URL quillmark-0.142.2-cp310-abi3-win_amd64.whl
Size 18.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0ae4c2028c68cae07c2cf1a7cfe79f60036d3cec2a900877938ad4970265e959
BLAKE2b-256 checksum
How to use checksums
e768daf1db5c59459a12c99ffefbf1a702f585f8f598cfe6e3c7c26c424385e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL quillmark-0.142.2-cp310-abi3-musllinux_1_2_x86_64.whl
Size 20.6 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
50f68de21ecf82a4619380f58b513b1bbb139f5f3754d36943c5fb802c018478
BLAKE2b-256 checksum
How to use checksums
2ff8b954d8cf16e04d752cba29267f0ffb49f93a487d6ab8fa89ebe91ed4ebd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL quillmark-0.142.2-cp310-abi3-musllinux_1_2_aarch64.whl
Size 19.5 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8c14a58f16ef74256a752b42f29c347232777c59ebe4a4194173b7d999aa9079
BLAKE2b-256 checksum
How to use checksums
c80eeb6a8749591e644b57791ec2bbfcd0375fdf50ac46b85589f5b27e25247e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL quillmark-0.142.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 20.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4210b0063e5b3e9b261c9ae393ec1aa5ed1c79160c82d0c770c8e3670a5ad63b
BLAKE2b-256 checksum
How to use checksums
766d5fce1084036a8baf9cc6cb9ffa3ec9cc680b779ba6b762040fd245f3fdd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL quillmark-0.142.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 19.3 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
374dfa5fd81fad75a67a38b1a3a5a3d660a58733ac91fc2727f322ae76f91858
BLAKE2b-256 checksum
How to use checksums
2e6f6476702a84fd74d26b743998425914c3c5ef88f759fd65c1fecc79982c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-macosx_11_0_arm64.whl

Download URL quillmark-0.142.2-cp310-abi3-macosx_11_0_arm64.whl
Size 17.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d65f74d9e190bec445f15416fa89b03500bce24f09be655c641b2226fdd35512
BLAKE2b-256 checksum
How to use checksums
77fa246c705de4ac59f4aed146961f8eacbe27547ad15c243177e2f4131c7073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / quillmark-0.142.2-cp310-abi3-macosx_10_12_x86_64.whl

Download URL quillmark-0.142.2-cp310-abi3-macosx_10_12_x86_64.whl
Size 19.1 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
18cde0ed7a61080779f37762b9285ed9bc65316af4a6c80036ef00b60a283327
BLAKE2b-256 checksum
How to use checksums
c4970aea6d9f4ba2739f42b914fb43094bac3f7ae0714def32382157846b2415
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for quillmark 0.142.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for quillmark-0.142.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.142.2 This release

8 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page