Skip to main content

textprov — Python SDK demonstration

This working experiment encodes and decodes human/ai classifications using variation selectors, plus a limited replacement-PUA mode. Standard library only; Python 3.9+. Package identity and version describe executable code, not a versioned proposal standard. It does not implement voice references or detect who wrote text.

Run from python/, or install this checkout with python3 -m pip install .:

import textprov

marked = textprov.mark("foo", state="ai")
assert marked == "f\U000E0101o\U000E0101o\U000E0101"
assert textprov.strip_marks(marked) == "foo"
textprov.runs(marked)  # [('ai', marked)]
textprov.to_html(marked)  # span carrying data-prov="ai"
textprov.mark_added("abc", "abXc")  # mark only inserted text
textprov.convert(marked, "vs", "pua")

mark and mark_added take state and mode (vs or pua). Only human and ai are accepted classifications. runs and to_html accept strip and merge_whitespace; HTML also accepts class_prefix. Core functions accept an explicit mapping=textprov.Mapping.load(path).

The PUA mode replaces eligible base characters, rather than appending metadata. The decoder recognizes selectors by value and collides with genuine Unicode variation sequences. Stripping arbitrary text can therefore destroy a glyph selection. Read the baseline limitations, VS profile, and additive-PUA candidate.

The proposal's model defines unattributed text as Voice0. This experiment reports unmarked runs as None; its classification labels are not implementations of nonzero voice references.

HTML display

to_html r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁s󠄁 s󠄁p󠄁a󠄁n󠄁s󠄁 w󠄁i󠄁t󠄁h󠄁o󠄁u󠄁t󠄁 i󠄁n󠄁j󠄁e󠄁c󠄁t󠄁i󠄁n󠄁g󠄁 s󠄁t󠄁y󠄁l󠄁e󠄁s󠄁.󠄁 stylesheet() r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁s󠄁 t󠄁h󠄁e󠄁 p󠄁a󠄁c󠄁k󠄁a󠄁g󠄁e󠄁d󠄁 r󠄁e󠄁v󠄁e󠄁a󠄁l󠄁 C󠄁S󠄁S󠄁:󠄁 g󠄁r󠄁a󠄁d󠄁i󠄁e󠄁n󠄁t󠄁 m󠄁i󠄁s󠄁t󠄁 a󠄁n󠄁d󠄁 a󠄁 d󠄁o󠄁t󠄁t󠄁e󠄁d󠄁 u󠄁n󠄁d󠄁e󠄁r󠄁l󠄁i󠄁n󠄁e󠄁 a󠄁t󠄁 8󠄁0󠄁%󠄁 s󠄁o󠄁u󠄁r󠄁c󠄁e󠄁-󠄁c󠄁o󠄁l󠄁o󠄁r󠄁 o󠄁p󠄁a󠄁c󠄁i󠄁t󠄁y󠄁.󠄁 T󠄁h󠄁e󠄁 w󠄁a󠄁v󠄁y󠄁/󠄁s󠄁a󠄁w󠄁t󠄁o󠄁o󠄁t󠄁h󠄁 p󠄁r󠄁o󠄁v󠄁e󠄁n󠄁a󠄁n󠄁c󠄁e󠄁 u󠄁n󠄁d󠄁e󠄁r󠄁l󠄁i󠄁n󠄁e󠄁 i󠄁s󠄁 d󠄁e󠄁f󠄁u󠄁n󠄁c󠄁t󠄁.󠄁

from pathlib import Path
import textprov

Path("textprov.css").write_text(textprov.stylesheet(), encoding="utf-8")
html = textprov.to_html(textprov.mark("A draft", state="ai"))

S󠄁e󠄁r󠄁v󠄁e󠄁 t󠄁h󠄁a󠄁t󠄁 C󠄁S󠄁S󠄁 a󠄁s󠄁 a󠄁 s󠄁t󠄁a󠄁t󠄁i󠄁c󠄁 a󠄁s󠄁s󠄁e󠄁t󠄁 a󠄁n󠄁d󠄁 l󠄁i󠄁n󠄁k󠄁 i󠄁t󠄁 f󠄁r󠄁o󠄁m󠄁 t󠄁h󠄁e󠄁 H󠄁T󠄁M󠄁L󠄁 d󠄁o󠄁c󠄁u󠄁m󠄁e󠄁n󠄁t󠄁.󠄁 T󠄁h󠄁e󠄁 s󠄁a󠄁m󠄁e󠄁 s󠄁t󠄁y󠄁l󠄁e󠄁s󠄁h󠄁e󠄁e󠄁t󠄁 s󠄁h󠄁i󠄁p󠄁s󠄁 i󠄁n󠄁 a󠄁l󠄁l󠄁 t󠄁h󠄁r󠄁e󠄁e󠄁 S󠄁D󠄁K󠄁s󠄁.󠄁 S󠄁e󠄁e󠄁 t󠄁h󠄁e󠄁 d󠄁i󠄁s󠄁p󠄁l󠄁a󠄁y󠄁 c󠄁o󠄁n󠄁v󠄁e󠄁n󠄁t󠄁i󠄁o󠄁n󠄁 f󠄁o󠄁r󠄁 n󠄁a󠄁t󠄁i󠄁v󠄁e󠄁 l󠄁i󠄁n󠄁k󠄁,󠄁 p󠄁r󠄁o󠄁o󠄁f󠄁i󠄁n󠄁g󠄁,󠄁 a󠄁n󠄁d󠄁 c󠄁o󠄁m󠄁m󠄁e󠄁n󠄁t󠄁 i󠄁n󠄁t󠄁e󠄁g󠄁r󠄁a󠄁t󠄁i󠄁o󠄁n󠄁.󠄁 U󠄁n󠄁m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 t󠄁e󠄁x󠄁t󠄁 r󠄁e󠄁m󠄁a󠄁i󠄁n󠄁s󠄁 u󠄁n󠄁a󠄁t󠄁t󠄁r󠄁i󠄁b󠄁u󠄁t󠄁e󠄁d󠄁.󠄁

Shared Chronicle and supplied attribution

The Chronicle guide documents local observations, claims and query APIs. Shared matching defines original-coordinate policies. The policy guide covers explicit supplied-claim transfers, durable evidence, experimental export and controlled exact Markdown edits. These APIs never infer authorship from a prompt, channel or matching passage.

Editing and workspace helpers

textprov.editing provides remark, rewrite_edit, human_shingles, and Ambiguous. These pure string operations preserve matched old marks and mark new text. Optional, explicitly supplied word shingles can label matching quotations human; this heuristic does not establish authorship or semantic faithfulness. rewrite_edit returns an exact replacement pair or None, and raises Ambiguous when one replacement cannot safely select a unique result.

textprov.workspace.Workspace(root) provides explicit filesystem integration: record_prompt, prepare_write, prepare_edit, apply_edit, before_command, after_command, and load_shingles. Preparation returns text for the caller to write; apply_edit writes directly. Prompt records live in <root>/.textprov unless state_dir is supplied. Recording a prompt applies the experimental human classification by policy; submission is not evidence of authorship. These helpers remain available as e󠄁x󠄁p󠄁e󠄁r󠄁i󠄁m󠄁e󠄁n󠄁t󠄁s󠄁.󠄁 T󠄁h󠄁e󠄁i󠄁r󠄁 M󠄁a󠄁r󠄁k󠄁d󠄁o󠄁w󠄁n󠄁 s󠄁c󠄁o󠄁p󠄁e󠄁,󠄁 p󠄁r󠄁o󠄁t󠄁e󠄁c󠄁t󠄁e󠄁d󠄁 s󠄁y󠄁n󠄁t󠄁a󠄁x󠄁,󠄁 p󠄁r󠄁o󠄁m󠄁p󠄁t󠄁 m󠄁a󠄁t󠄁c󠄁h󠄁i󠄁n󠄁g󠄁,󠄁 a󠄁n󠄁d󠄁 c󠄁o󠄁m󠄁m󠄁a󠄁n󠄁d󠄁 s󠄁n󠄁a󠄁p󠄁s󠄁h󠄁o󠄁t󠄁s󠄁 a󠄁r󠄁e󠄁 i󠄁m󠄁p󠄁l󠄁e󠄁m󠄁e󠄁n󠄁t󠄁a󠄁t󠄁i󠄁o󠄁n󠄁 p󠄁o󠄁l󠄁i󠄁c󠄁y󠄁 r󠄁a󠄁t󠄁h󠄁e󠄁r󠄁 t󠄁h󠄁a󠄁n󠄁 p󠄁r󠄁o󠄁p󠄁o󠄁s󠄁a󠄁l󠄁 r󠄁e󠄁q󠄁u󠄁i󠄁r󠄁e󠄁m󠄁e󠄁n󠄁t󠄁s󠄁.󠄁 H󠄁o󠄁s󠄁t󠄁 p󠄁l󠄁u󠄁g󠄁i󠄁n󠄁s󠄁 c󠄁a󠄁n󠄁 a󠄁p󠄁p󠄁l󠄁y󠄁 t󠄁h󠄁e󠄁 s󠄁i󠄁m󠄁p󠄁l󠄁e󠄁r󠄁 a󠄁u󠄁t󠄁o󠄁m󠄁a󠄁t󠄁i󠄁c󠄁 p󠄁o󠄁l󠄁i󠄁c󠄁y󠄁 b󠄁e󠄁l󠄁o󠄁w󠄁 w󠄁i󠄁t󠄁h󠄁o󠄁u󠄁t󠄁 p󠄁r󠄁o󠄁m󠄁p󠄁t󠄁 m󠄁a󠄁t󠄁c󠄁h󠄁i󠄁n󠄁g󠄁 o󠄁r󠄁 m󠄁a󠄁n󠄁u󠄁a󠄁l󠄁 c󠄁l󠄁a󠄁i󠄁m󠄁s󠄁.󠄁

Chat and document marking

T󠄁h󠄁e󠄁 d󠄁e󠄁f󠄁a󠄁u󠄁l󠄁t󠄁 c󠄁h󠄁a󠄁t󠄁 s󠄁c󠄁o󠄁p󠄁e󠄁 i󠄁s󠄁 prose:󠄁 u󠄁n󠄁m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 u󠄁s󠄁e󠄁r󠄁 p󠄁r󠄁o󠄁s󠄁e󠄁 r󠄁e󠄁c󠄁e󠄁i󠄁v󠄁e󠄁s󠄁 h󠄁u󠄁m󠄁a󠄁n󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁 a󠄁n󠄁d󠄁 a󠄁s󠄁s󠄁i󠄁s󠄁t󠄁a󠄁n󠄁t󠄁 p󠄁r󠄁o󠄁s󠄁e󠄁 r󠄁e󠄁c󠄁e󠄁i󠄁v󠄁e󠄁s󠄁 A󠄁I󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 C󠄁o󠄁d󠄁e󠄁 b󠄁l󠄁o󠄁c󠄁k󠄁s󠄁,󠄁 i󠄁n󠄁l󠄁i󠄁n󠄁e󠄁 c󠄁o󠄁d󠄁e󠄁,󠄁 l󠄁i󠄁n󠄁k󠄁 d󠄁e󠄁s󠄁t󠄁i󠄁n󠄁a󠄁t󠄁i󠄁o󠄁n󠄁s󠄁 a󠄁n󠄁d󠄁 o󠄁t󠄁h󠄁e󠄁r󠄁 p󠄁r󠄁o󠄁t󠄁e󠄁c󠄁t󠄁e󠄁d󠄁 M󠄁a󠄁r󠄁k󠄁d󠄁o󠄁w󠄁n󠄁 s󠄁y󠄁n󠄁t󠄁a󠄁x󠄁 r󠄁e󠄁c󠄁e󠄁i󠄁v󠄁e󠄁 n󠄁o󠄁 n󠄁e󠄁w󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 E󠄁x󠄁i󠄁s󠄁t󠄁i󠄁n󠄁g󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁 t󠄁a󠄁k󠄁e󠄁 p󠄁r󠄁e󠄁c󠄁e󠄁d󠄁e󠄁n󠄁c󠄁e󠄁,󠄁 i󠄁n󠄁c󠄁l󠄁u󠄁d󠄁i󠄁n󠄁g󠄁 t󠄁h󠄁o󠄁s󠄁e󠄁 i󠄁n󠄁 p󠄁a󠄁s󠄁t󠄁e󠄁d󠄁 c󠄁o󠄁d󠄁e󠄁.󠄁 T󠄁h󠄁e󠄁 s󠄁p󠄁e󠄁a󠄁k󠄁e󠄁r󠄁 p󠄁o󠄁l󠄁i󠄁c󠄁y󠄁 d󠄁o󠄁e󠄁s󠄁 n󠄁o󠄁t󠄁 i󠄁n󠄁f󠄁e󠄁r󠄁 w󠄁h󠄁o󠄁 o󠄁r󠄁i󠄁g󠄁i󠄁n󠄁a󠄁l󠄁l󠄁y󠄁 w󠄁r󠄁o󠄁t󠄁e󠄁 u󠄁n󠄁m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 p󠄁a󠄁s󠄁t󠄁e󠄁d󠄁 t󠄁e󠄁x󠄁t󠄁.󠄁

U󠄁s󠄁e󠄁 scope="all" t󠄁o󠄁 m󠄁a󠄁r󠄁k󠄁 e󠄁v󠄁e󠄁r󠄁y󠄁 e󠄁l󠄁i󠄁g󠄁i󠄁b󠄁l󠄁e󠄁 c󠄁l󠄁u󠄁s󠄁t󠄁e󠄁r󠄁,󠄁 i󠄁n󠄁c󠄁l󠄁u󠄁d󠄁i󠄁n󠄁g󠄁 f󠄁e󠄁n󠄁c󠄁e󠄁d󠄁 p󠄁r󠄁o󠄁s󠄁e󠄁 b󠄁e󠄁i󠄁n󠄁g󠄁 d󠄁r󠄁a󠄁f󠄁t󠄁e󠄁d󠄁 f󠄁o󠄁r󠄁 a󠄁n󠄁o󠄁t󠄁h󠄁e󠄁r󠄁 p󠄁r󠄁o󠄁m󠄁p󠄁t󠄁.󠄁 U󠄁s󠄁e󠄁 scope="off" t󠄁o󠄁 s󠄁t󠄁o󠄁p󠄁 a󠄁d󠄁d󠄁i󠄁n󠄁g󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 B󠄁o󠄁t󠄁h󠄁 p󠄁r󠄁e󠄁s󠄁e󠄁r󠄁v󠄁e󠄁 e󠄁x󠄁i󠄁s󠄁t󠄁i󠄁n󠄁g󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 P󠄁r󠄁o󠄁s󠄁e󠄁 d󠄁e󠄁t󠄁e󠄁c󠄁t󠄁i󠄁o󠄁n󠄁 p󠄁r󠄁o󠄁t󠄁e󠄁c󠄁t󠄁s󠄁 M󠄁a󠄁r󠄁k󠄁d󠄁o󠄁w󠄁n󠄁 l󠄁i󠄁t󠄁e󠄁r󠄁a󠄁l󠄁s󠄁;󠄁 b󠄁a󠄁r󠄁e󠄁 c󠄁o󠄁m󠄁m󠄁a󠄁n󠄁d󠄁s󠄁 o󠄁u󠄁t󠄁s󠄁i󠄁d󠄁e󠄁 c󠄁o󠄁d󠄁e󠄁 d󠄁e󠄁l󠄁i󠄁m󠄁i󠄁t󠄁e󠄁r󠄁s󠄁 m󠄁a󠄁y󠄁 s󠄁t󠄁i󠄁l󠄁l󠄁 r󠄁e󠄁c󠄁e󠄁i󠄁v󠄁e󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 T󠄁o󠄁 c󠄁o󠄁p󠄁y󠄁 a󠄁n󠄁 a󠄁l󠄁r󠄁e󠄁a󠄁d󠄁y󠄁 m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 c󠄁o󠄁m󠄁m󠄁a󠄁n󠄁d󠄁,󠄁 e󠄁x󠄁p󠄁l󠄁i󠄁c󠄁i󠄁t󠄁l󠄁y󠄁 s󠄁t󠄁r󠄁i󠄁p󠄁 T󠄁e󠄁x󠄁t󠄁P󠄁r󠄁o󠄁v󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁 f󠄁r󠄁o󠄁m󠄁 t󠄁h󠄁e󠄁 c󠄁o󠄁p󠄁y󠄁,󠄁 p󠄁r󠄁e󠄁s󠄁e󠄁r󠄁v󠄁i󠄁n󠄁g󠄁 t󠄁h󠄁e󠄁 s󠄁o󠄁u󠄁r󠄁c󠄁e󠄁.󠄁

from textprov import mark_chat, mark_document, mark_document_edit

human_message = mark_chat("My message", "user")
ai_message = mark_chat("Run `git status`.", "assistant")
marked_prompt = mark_chat("```text\nPrompt draft\n```", "assistant", scope="all")
unchanged = mark_chat(previous_raw_text, "assistant", scope="off")
new_draft = mark_document("New prose.")
edited_draft = mark_document_edit(previous_raw_text, proposed_text)

D󠄁o󠄁c󠄁u󠄁m󠄁e󠄁n󠄁t󠄁 e󠄁d󠄁i󠄁t󠄁s󠄁 m󠄁a󠄁r󠄁k󠄁 A󠄁I󠄁 a󠄁d󠄁d󠄁i󠄁t󠄁i󠄁o󠄁n󠄁s󠄁 a󠄁n󠄁d󠄁 r󠄁e󠄁p󠄁l󠄁a󠄁c󠄁e󠄁m󠄁e󠄁n󠄁t󠄁s󠄁,󠄁 c󠄁a󠄁r󠄁r󠄁y󠄁 e󠄁x󠄁i󠄁s󠄁t󠄁i󠄁n󠄁g󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁 o󠄁n󠄁 u󠄁n󠄁c󠄁h󠄁a󠄁n󠄁g󠄁e󠄁d󠄁 t󠄁e󠄁x󠄁t󠄁 e󠄁v󠄁e󠄁n󠄁 w󠄁h󠄁e󠄁n󠄁 t󠄁h󠄁e󠄁 p󠄁r󠄁o󠄁p󠄁o󠄁s󠄁e󠄁d󠄁 t󠄁e󠄁x󠄁t󠄁 o󠄁m󠄁i󠄁t󠄁s󠄁 t󠄁h󠄁e󠄁m󠄁,󠄁 a󠄁n󠄁d󠄁 p󠄁r󠄁e󠄁s󠄁e󠄁r󠄁v󠄁e󠄁 u󠄁n󠄁m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 u󠄁n󠄁c󠄁h󠄁a󠄁n󠄁g󠄁e󠄁d󠄁 e󠄁d󠄁i󠄁t󠄁o󠄁r󠄁 t󠄁e󠄁x󠄁t󠄁.󠄁 T󠄁h󠄁e󠄁y󠄁 u󠄁s󠄁e󠄁 t󠄁h󠄁e󠄁 e󠄁x󠄁i󠄁s󠄁t󠄁i󠄁n󠄁g󠄁 w󠄁h󠄁o󠄁l󠄁e󠄁-󠄁l󠄁i󠄁n󠄁e󠄁/󠄁w󠄁h󠄁o󠄁l󠄁e󠄁-󠄁w󠄁o󠄁r󠄁d󠄁 a󠄁l󠄁i󠄁g󠄁n󠄁m󠄁e󠄁n󠄁t󠄁 a󠄁n󠄁d󠄁 c󠄁o󠄁n󠄁s󠄁e󠄁r󠄁v󠄁a󠄁t󠄁i󠄁v󠄁e󠄁 M󠄁a󠄁r󠄁k󠄁d󠄁o󠄁w󠄁n󠄁 p󠄁r󠄁o󠄁t󠄁e󠄁c󠄁t󠄁i󠄁o󠄁n󠄁,󠄁 s󠄁o󠄁 c󠄁o󠄁d󠄁e󠄁,󠄁 d󠄁e󠄁s󠄁t󠄁i󠄁n󠄁a󠄁t󠄁i󠄁o󠄁n󠄁s󠄁,󠄁 a󠄁n󠄁d󠄁 p󠄁r󠄁o󠄁t󠄁e󠄁c󠄁t󠄁e󠄁d󠄁 s󠄁y󠄁n󠄁t󠄁a󠄁x󠄁 r󠄁e󠄁m󠄁a󠄁i󠄁n󠄁 e󠄁x󠄁e󠄁c󠄁u󠄁t󠄁a󠄁b󠄁l󠄁e󠄁 a󠄁n󠄁d󠄁 p󠄁a󠄁r󠄁s󠄁e󠄁a󠄁b󠄁l󠄁e󠄁.󠄁 F󠄁o󠄁r󠄁 e󠄁x󠄁a󠄁c󠄁t󠄁 n󠄁a󠄁t󠄁i󠄁v󠄁e󠄁-󠄁t󠄁o󠄁o󠄁l󠄁 e󠄁d󠄁i󠄁t󠄁s󠄁 a󠄁g󠄁a󠄁i󠄁n󠄁s󠄁t󠄁 m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 f󠄁i󠄁l󠄁e󠄁s󠄁,󠄁 textprov.editing.rewrite_edit r󠄁e󠄁s󠄁o󠄁l󠄁v󠄁e󠄁s󠄁 m󠄁a󠄁r󠄁k󠄁e󠄁r󠄁-󠄁i󠄁n󠄁s󠄁e󠄁n󠄁s󠄁i󠄁t󠄁i󠄁v󠄁e󠄁 a󠄁n󠄁c󠄁h󠄁o󠄁r󠄁s󠄁 a󠄁n󠄁d󠄁 r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁s󠄁 a󠄁n󠄁 e󠄁x󠄁a󠄁c󠄁t󠄁 r󠄁a󠄁w󠄁 r󠄁e󠄁p󠄁l󠄁a󠄁c󠄁e󠄁m󠄁e󠄁n󠄁t󠄁 p󠄁a󠄁i󠄁r󠄁.󠄁 A󠄁m󠄁b󠄁i󠄁g󠄁u󠄁o󠄁u󠄁s󠄁 m󠄁a󠄁t󠄁c󠄁h󠄁e󠄁s󠄁 r󠄁e󠄁q󠄁u󠄁i󠄁r󠄁e󠄁 m󠄁o󠄁r󠄁e󠄁 c󠄁o󠄁n󠄁t󠄁e󠄁x󠄁t󠄁.󠄁 O󠄁r󠄁d󠄁i󠄁n󠄁a󠄁r󠄁y󠄁 e󠄁d󠄁i󠄁t󠄁o󠄁r󠄁s󠄁 a󠄁r󠄁e󠄁 n󠄁o󠄁t󠄁 w󠄁a󠄁t󠄁c󠄁h󠄁e󠄁d󠄁 o󠄁r󠄁 m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁.󠄁

M󠄁a󠄁r󠄁k󠄁s󠄁 a󠄁r󠄁e󠄁 a󠄁c󠄁t󠄁u󠄁a󠄁l󠄁 U󠄁n󠄁i󠄁c󠄁o󠄁d󠄁e󠄁 c󠄁h󠄁a󠄁r󠄁a󠄁c󠄁t󠄁e󠄁r󠄁s󠄁 i󠄁n󠄁 t󠄁h󠄁e󠄁 t󠄁e󠄁x󠄁t󠄁 p󠄁a󠄁y󠄁l󠄁o󠄁a󠄁d󠄁.󠄁 U󠄁T󠄁F󠄁-󠄁8󠄁 a󠄁n󠄁d󠄁 J󠄁S󠄁O󠄁N󠄁 r󠄁o󠄁u󠄁n󠄁d󠄁t󠄁r󠄁i󠄁p󠄁s󠄁 p󠄁r󠄁e󠄁s󠄁e󠄁r󠄁v󠄁e󠄁 t󠄁h󠄁e󠄁m󠄁;󠄁 c󠄁o󠄁p󠄁y󠄁i󠄁n󠄁g󠄁 i󠄁n󠄁t󠄁o󠄁 a󠄁 d󠄁e󠄁s󠄁t󠄁i󠄁n󠄁a󠄁t󠄁i󠄁o󠄁n󠄁 t󠄁h󠄁a󠄁t󠄁 r󠄁e󠄁m󠄁o󠄁v󠄁e󠄁s󠄁 v󠄁a󠄁r󠄁i󠄁a󠄁t󠄁i󠄁o󠄁n󠄁 s󠄁e󠄁l󠄁e󠄁c󠄁t󠄁o󠄁r󠄁s󠄁 c󠄁a󠄁n󠄁n󠄁o󠄁t󠄁 p󠄁r󠄁e󠄁s󠄁e󠄁r󠄁v󠄁e󠄁 p󠄁r󠄁o󠄁v󠄁e󠄁n󠄁a󠄁n󠄁c󠄁e󠄁.󠄁 C󠄁l󠄁i󠄁p󠄁b󠄁o󠄁a󠄁r󠄁d󠄁 a󠄁n󠄁d󠄁 r󠄁e󠄁n󠄁d󠄁e󠄁r󠄁e󠄁r󠄁 b󠄁e󠄁h󠄁a󠄁v󠄁i󠄁o󠄁r󠄁 s󠄁t󠄁i󠄁l󠄁l󠄁 n󠄁e󠄁e󠄁d󠄁s󠄁 v󠄁e󠄁r󠄁i󠄁f󠄁i󠄁c󠄁a󠄁t󠄁i󠄁o󠄁n󠄁 i󠄁n󠄁 e󠄁a󠄁c󠄁h󠄁 h󠄁o󠄁s󠄁t󠄁.󠄁

A󠄁d󠄁a󠄁p󠄁t󠄁e󠄁r󠄁s󠄁 c󠄁a󠄁n󠄁 c󠄁a󠄁l󠄁l󠄁 python -m textprov.marking w󠄁i󠄁t󠄁h󠄁 o󠄁n󠄁e󠄁 J󠄁S󠄁O󠄁N󠄁 r󠄁e󠄁q󠄁u󠄁e󠄁s󠄁t󠄁 o󠄁n󠄁 s󠄁t󠄁d󠄁i󠄁n󠄁:󠄁 {"operation":"mark-chat","text":"Hello","role":"assistant","scope":"prose"} o󠄁r󠄁 {"operation":"mark-document","old_text":"Old prose","text":"New prose"}.󠄁 T󠄁h󠄁e󠄁 r󠄁e󠄁s󠄁p󠄁o󠄁n󠄁s󠄁e󠄁 i󠄁s󠄁 {"text":"…"}.󠄁 scope d󠄁e󠄁f󠄁a󠄁u󠄁l󠄁t󠄁s󠄁 t󠄁o󠄁 prose;󠄁 old_text d󠄁e󠄁f󠄁a󠄁u󠄁l󠄁t󠄁s󠄁 t󠄁o󠄁 e󠄁m󠄁p󠄁t󠄁y󠄁 f󠄁o󠄁r󠄁 n󠄁e󠄁w󠄁 d󠄁o󠄁c󠄁u󠄁m󠄁e󠄁n󠄁t󠄁s󠄁.󠄁 A󠄁n󠄁 e󠄁x󠄁p󠄁l󠄁i󠄁c󠄁i󠄁t󠄁 {"operation":"strip-marks","text":"…"} r󠄁e󠄁q󠄁u󠄁e󠄁s󠄁t󠄁 r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁s󠄁 a󠄁 c󠄁o󠄁p󠄁y󠄁 w󠄁i󠄁t󠄁h󠄁o󠄁u󠄁t󠄁 T󠄁e󠄁x󠄁t󠄁P󠄁r󠄁o󠄁v󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁.󠄁 T󠄁h󠄁i󠄁s󠄁 i󠄁s󠄁 n󠄁o󠄁t󠄁 a󠄁 g󠄁e󠄁n󠄁e󠄁r󠄁a󠄁l󠄁 U󠄁n󠄁i󠄁c󠄁o󠄁d󠄁e󠄁 s󠄁a󠄁n󠄁i󠄁t󠄁i󠄁z󠄁e󠄁r󠄁;󠄁 t󠄁h󠄁e󠄁 e󠄁x󠄁p󠄁e󠄁r󠄁i󠄁m󠄁e󠄁n󠄁t󠄁a󠄁l󠄁 V󠄁S󠄁 p󠄁r󠄁o󠄁f󠄁i󠄁l󠄁e󠄁 h󠄁a󠄁s󠄁 t󠄁h󠄁e󠄁 c󠄁o󠄁l󠄁l󠄁i󠄁s󠄁i󠄁o󠄁n󠄁 l󠄁i󠄁m󠄁i󠄁t󠄁a󠄁t󠄁i󠄁o󠄁n󠄁s󠄁 d󠄁e󠄁s󠄁c󠄁r󠄁i󠄁b󠄁e󠄁d󠄁 i󠄁n󠄁 t󠄁h󠄁e󠄁 V󠄁S󠄁 a󠄁s󠄁s󠄁e󠄁s󠄁s󠄁m󠄁e󠄁n󠄁t󠄁.󠄁

C󠄁h󠄁a󠄁t󠄁 m󠄁a󠄁r󠄁k󠄁i󠄁n󠄁g󠄁 e󠄁x󠄁p󠄁e󠄁c󠄁t󠄁s󠄁 c󠄁o󠄁m󠄁p󠄁l󠄁e󠄁t󠄁e󠄁 M󠄁a󠄁r󠄁k󠄁d󠄁o󠄁w󠄁n󠄁 t󠄁e󠄁x󠄁t󠄁.󠄁 F󠄁o󠄁r󠄁 m󠄁e󠄁s󠄁s󠄁a󠄁g󠄁e󠄁s󠄁 s󠄁p󠄁l󠄁i󠄁t󠄁 a󠄁c󠄁r󠄁o󠄁s󠄁s󠄁 t󠄁e󠄁x󠄁t󠄁 b󠄁l󠄁o󠄁c󠄁k󠄁s󠄁,󠄁 mark_chat_parts(parts, role, scope="prose") r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁s󠄁 a󠄁 l󠄁i󠄁s󠄁t󠄁 w󠄁i󠄁t󠄁h󠄁 t󠄁h󠄁e󠄁 s󠄁a󠄁m󠄁e󠄁 b󠄁l󠄁o󠄁c󠄁k󠄁 b󠄁o󠄁u󠄁n󠄁d󠄁a󠄁r󠄁i󠄁e󠄁s󠄁,󠄁 c󠄁l󠄁a󠄁s󠄁s󠄁i󠄁f󠄁y󠄁i󠄁n󠄁g󠄁 t󠄁h󠄁e󠄁i󠄁r󠄁 j󠄁o󠄁i󠄁n󠄁e󠄁d󠄁 t󠄁e󠄁x󠄁t󠄁 o󠄁n󠄁c󠄁e󠄁.󠄁 I󠄁t󠄁s󠄁 J󠄁S󠄁O󠄁N󠄁 o󠄁p󠄁e󠄁r󠄁a󠄁t󠄁i󠄁o󠄁n󠄁 i󠄁s󠄁 mark-chat-parts,󠄁 w󠄁i󠄁t󠄁h󠄁 parts i󠄁n󠄁 p󠄁l󠄁a󠄁c󠄁e󠄁 o󠄁f󠄁 text,󠄁 r󠄁e󠄁t󠄁u󠄁r󠄁n󠄁i󠄁n󠄁g󠄁 {"parts":["…"]}.󠄁 C󠄁a󠄁l󠄁l󠄁e󠄁r󠄁s󠄁 m󠄁u󠄁s󠄁t󠄁 n󠄁o󠄁t󠄁 t󠄁r󠄁a󠄁n󠄁s󠄁f󠄁o󠄁r󠄁m󠄁 i󠄁n󠄁d󠄁e󠄁p󠄁e󠄁n󠄁d󠄁e󠄁n󠄁t󠄁 s󠄁t󠄁r󠄁e󠄁a󠄁m󠄁i󠄁n󠄁g󠄁 c󠄁h󠄁u󠄁n󠄁k󠄁s󠄁:󠄁 d󠄁e󠄁l󠄁i󠄁m󠄁i󠄁t󠄁e󠄁r󠄁s󠄁 a󠄁n󠄁d󠄁 g󠄁r󠄁a󠄁p󠄁h󠄁e󠄁m󠄁e󠄁 c󠄁l󠄁u󠄁s󠄁t󠄁e󠄁r󠄁s󠄁 c󠄁a󠄁n󠄁 s󠄁p󠄁a󠄁n󠄁 c󠄁h󠄁u󠄁n󠄁k󠄁s󠄁.󠄁

CLI

python3 -m textprov -o marked.txt mark --ai draft.txt
python3 -m textprov mark-added old.txt new.txt
python3 -m textprov convert --from vs --to pua marked.txt
python3 -m textprov strip marked.txt
python3 -m textprov render marked.txt
python3 -m textprov inspect marked.txt

Installed packages also expose textprov. A file argument may be - for stdin; output goes to stdout unless -o is supplied. UTF-8 line endings are preserved. Legacy SPEC_VERSION is a baseline identifier, not a proposal version.

Checks

From python/:

python3 -m unittest discover -s tests -t .

Checks cover shared fixtures, vendored mapping agreement, producer behavior, editing/workspace helpers, CLI output, and Unicode 17.0.0 grapheme segmentation. See UCD sources.

Apache-2.0; see LICENSE.

Passage and exact display

passages = textprov.to_html(marked_text, strip=True)  # default display="passage"
exact = textprov.to_html(marked_text, strip=True, display="exact", merge_whitespace=False)

T󠄁h󠄁e󠄁 C󠄁L󠄁I󠄁 a󠄁c󠄁c󠄁e󠄁p󠄁t󠄁s󠄁 textprov render --display passage|exact FILE.󠄁

P󠄁a󠄁s󠄁s󠄁a󠄁g󠄁e󠄁 v󠄁i󠄁e󠄁w󠄁 i󠄁s󠄁 t󠄁h󠄁e󠄁 d󠄁e󠄁f󠄁a󠄁u󠄁l󠄁t󠄁.󠄁 I󠄁t󠄁 h󠄁i󠄁g󠄁h󠄁l󠄁i󠄁g󠄁h󠄁t󠄁s󠄁 a󠄁 p󠄁a󠄁s󠄁s󠄁a󠄁g󠄁e󠄁 c󠄁o󠄁n󠄁t󠄁a󠄁i󠄁n󠄁i󠄁n󠄁g󠄁 r󠄁e󠄁c󠄁o󠄁r󠄁d󠄁e󠄁d󠄁 m󠄁a󠄁r󠄁k󠄁s󠄁,󠄁 i󠄁n󠄁c󠄁l󠄁u󠄁d󠄁i󠄁n󠄁g󠄁 u󠄁n󠄁m󠄁a󠄁r󠄁k󠄁e󠄁d󠄁 c󠄁h󠄁a󠄁r󠄁a󠄁c󠄁t󠄁e󠄁r󠄁s󠄁 b󠄁e󠄁t󠄁w󠄁e󠄁e󠄁n󠄁 t󠄁h󠄁e󠄁m󠄁;󠄁 i󠄁t󠄁 d󠄁o󠄁e󠄁s󠄁 n󠄁o󠄁t󠄁 a󠄁s󠄁s󠄁i󠄁g󠄁n󠄁 t󠄁h󠄁o󠄁s󠄁e󠄁 c󠄁h󠄁a󠄁r󠄁a󠄁c󠄁t󠄁e󠄁r󠄁s󠄁 a󠄁n󠄁 o󠄁r󠄁i󠄁g󠄁i󠄁n󠄁.󠄁 P󠄁l󠄁a󠄁i󠄁n󠄁 p󠄁a󠄁r󠄁a󠄁g󠄁r󠄁a󠄁p󠄁h󠄁s󠄁 s󠄁t󠄁a󠄁y󠄁 p󠄁l󠄁a󠄁i󠄁n󠄁.󠄁 A󠄁 p󠄁a󠄁s󠄁s󠄁a󠄁g󠄁e󠄁 c󠄁o󠄁n󠄁t󠄁a󠄁i󠄁n󠄁i󠄁n󠄁g󠄁 b󠄁o󠄁t󠄁h󠄁 b󠄁a󠄁s󠄁e󠄁l󠄁i󠄁n󠄁e󠄁 c󠄁l󠄁a󠄁s󠄁s󠄁i󠄁f󠄁i󠄁c󠄁a󠄁t󠄁i󠄁o󠄁n󠄁s󠄁 u󠄁s󠄁e󠄁s󠄁 a󠄁 n󠄁e󠄁u󠄁t󠄁r󠄁a󠄁l󠄁 m󠄁i󠄁x󠄁e󠄁d󠄁 t󠄁r󠄁e󠄁a󠄁t󠄁m󠄁e󠄁n󠄁t󠄁.󠄁 E󠄁x󠄁a󠄁c󠄁t󠄁 [data-prov] s󠄁p󠄁a󠄁n󠄁s󠄁 r󠄁e󠄁m󠄁a󠄁i󠄁n󠄁 s󠄁e󠄁p󠄁a󠄁r󠄁a󠄁t󠄁e󠄁 f󠄁r󠄁o󠄁m󠄁 t󠄁h󠄁e󠄁 d󠄁i󠄁s󠄁p󠄁l󠄁a󠄁y󠄁-󠄁o󠄁n󠄁l󠄁y󠄁 [data-prov-passage] w󠄁r󠄁a󠄁p󠄁p󠄁e󠄁r󠄁.󠄁

D󠄁O󠄁M󠄁 p󠄁a󠄁s󠄁s󠄁a󠄁g󠄁e󠄁s󠄁 f󠄁o󠄁l󠄁l󠄁o󠄁w󠄁 p󠄁a󠄁r󠄁a󠄁g󠄁r󠄁a󠄁p󠄁h󠄁s󠄁,󠄁 h󠄁e󠄁a󠄁d󠄁i󠄁n󠄁g󠄁s󠄁,󠄁 l󠄁i󠄁s󠄁t󠄁 i󠄁t󠄁e󠄁m󠄁s󠄁,󠄁 a󠄁n󠄁d󠄁 t󠄁a󠄁b󠄁l󠄁e󠄁 c󠄁e󠄁l󠄁l󠄁s󠄁 w󠄁h󠄁i󠄁l󠄁e󠄁 r󠄁e󠄁t󠄁a󠄁i󠄁n󠄁i󠄁n󠄁g󠄁 i󠄁n󠄁l󠄁i󠄁n󠄁e󠄁 f󠄁o󠄁r󠄁m󠄁a󠄁t󠄁t󠄁i󠄁n󠄁g󠄁.󠄁 P󠄁l󠄁a󠄁i󠄁n󠄁-󠄁t󠄁e󠄁x󠄁t󠄁 H󠄁T󠄁M󠄁L󠄁 e󠄁x󠄁p󠄁o󠄁r󠄁t󠄁s󠄁 u󠄁s󠄁e󠄁 b󠄁l󠄁a󠄁n󠄁k󠄁 l󠄁i󠄁n󠄁e󠄁s󠄁 a󠄁s󠄁 p󠄁a󠄁r󠄁a󠄁g󠄁r󠄁a󠄁p󠄁h󠄁 b󠄁o󠄁u󠄁n󠄁d󠄁a󠄁r󠄁i󠄁e󠄁s󠄁.󠄁 T󠄁h󠄁e󠄁 o󠄁p󠄁t󠄁i󠄁o󠄁n󠄁a󠄁l󠄁 s󠄁h󠄁a󠄁r󠄁e󠄁d󠄁 s󠄁t󠄁y󠄁l󠄁e󠄁s󠄁h󠄁e󠄁e󠄁t󠄁 p󠄁a󠄁i󠄁n󠄁t󠄁s󠄁 t󠄁h󠄁e󠄁 s󠄁e󠄁l󠄁e󠄁c󠄁t󠄁e󠄁d󠄁 l󠄁a󠄁y󠄁e󠄁r󠄁 o󠄁n󠄁l󠄁y󠄁.󠄁 S󠄁w󠄁i󠄁t󠄁c󠄁h󠄁i󠄁n󠄁g󠄁 a󠄁n󠄁 a󠄁n󠄁c󠄁e󠄁s󠄁t󠄁o󠄁r󠄁'󠄁s󠄁 data-prov-display b󠄁e󠄁t󠄁w󠄁e󠄁e󠄁n󠄁 passage a󠄁n󠄁d󠄁 exact c󠄁h󠄁a󠄁n󠄁g󠄁e󠄁s󠄁 p󠄁a󠄁i󠄁n󠄁t󠄁 w󠄁i󠄁t󠄁h󠄁o󠄁u󠄁t󠄁 c󠄁h󠄁a󠄁n󠄁g󠄁i󠄁n󠄁g󠄁 t󠄁e󠄁x󠄁t󠄁 o󠄁r󠄁 e󠄁x󠄁a󠄁c󠄁t󠄁 s󠄁p󠄁a󠄁n󠄁s󠄁.󠄁

T󠄁h󠄁e󠄁 d󠄁e󠄁c󠄁o󠄁d󠄁e󠄁r󠄁'󠄁s󠄁 runs() A󠄁P󠄁I󠄁 i󠄁s󠄁 u󠄁n󠄁c󠄁h󠄁a󠄁n󠄁g󠄁e󠄁d󠄁.󠄁 F󠄁o󠄁r󠄁 e󠄁x󠄁a󠄁c󠄁t󠄁 w󠄁h󠄁i󠄁t󠄁e󠄁s󠄁p󠄁a󠄁c󠄁e󠄁 a󠄁t󠄁t󠄁r󠄁i󠄁b󠄁u󠄁t󠄁i󠄁o󠄁n󠄁,󠄁 u󠄁s󠄁e󠄁 merge_whitespace: false (󠄁J󠄁a󠄁v󠄁a󠄁S󠄁c󠄁r󠄁i󠄁p󠄁t󠄁/󠄁R󠄁u󠄁b󠄁y󠄁)󠄁 o󠄁r󠄁 merge_whitespace=False (󠄁P󠄁y󠄁t󠄁h󠄁o󠄁n󠄁)󠄁.󠄁 P󠄁a󠄁s󠄁s󠄁a󠄁g󠄁e󠄁 m󠄁e󠄁t󠄁a󠄁d󠄁a󠄁t󠄁a󠄁 a󠄁l󠄁w󠄁a󠄁y󠄁s󠄁 k󠄁e󠄁e󠄁p󠄁s󠄁 w󠄁h󠄁i󠄁t󠄁e󠄁s󠄁p󠄁a󠄁c󠄁e󠄁 u󠄁n󠄁a󠄁s󠄁s󠄁i󠄁g󠄁n󠄁e󠄁d󠄁;󠄁 t󠄁h󠄁e󠄁 l󠄁e󠄁g󠄁a󠄁c󠄁y󠄁 w󠄁h󠄁i󠄁t󠄁e󠄁s󠄁p󠄁a󠄁c󠄁e󠄁-󠄁m󠄁e󠄁r󠄁g󠄁e󠄁 o󠄁p󠄁t󠄁i󠄁o󠄁n󠄁 a󠄁p󠄁p󠄁l󠄁i󠄁e󠄁s󠄁 t󠄁o󠄁 e󠄁x󠄁p󠄁l󠄁i󠄁c󠄁i󠄁t󠄁l󠄁y󠄁 r󠄁e󠄁q󠄁u󠄁e󠄁s󠄁t󠄁e󠄁d󠄁 e󠄁x󠄁a󠄁c󠄁t󠄁 H󠄁T󠄁M󠄁L󠄁 o󠄁u󠄁t󠄁p󠄁u󠄁t󠄁.󠄁

Metadata

Release files for textprov 0.2.0

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

Source distribution (sdist)

Source distribution for textprov 0.2.0
File Size Uploaded Provenance Actions
textprov-0.2.0.tar.gz 101.1 kB With provenance Details for textprov-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for textprov 0.2.0
File Interpreter ABI Platform Actions
textprov-0.2.0-py3-none-any.whl Python 3 none any Details for textprov-0.2.0-py3-none-any.whl

Total release size: 167.3 kB

Release files / textprov-0.2.0.tar.gz

Download URL textprov-0.2.0.tar.gz
Size 101.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9db50f65a1761e26466e5de7dd8d043383ca56e4e23da62bcdad76d23e85639b
BLAKE2b-256 checksum
How to use checksums
6fd06b883873d23626802784e97d97b3926cbd3a2cf1fc6f2ac0c761fcc96eff
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 Oct 29, 2026.

Transparency log

Release files / textprov-0.2.0-py3-none-any.whl

Download URL textprov-0.2.0-py3-none-any.whl
Size 66.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3622732c9f1f23b3244f6c5be42a8a7490727a7f2bf0095b2af40f2f0a551d94
BLAKE2b-256 checksum
How to use checksums
ab01769ac8a2c512dcf3e5f6184f7af9961072e7ed40c340a3c2f646c7354ce2
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 Oct 29, 2026.

Transparency log

Security for textprov 0.2.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for textprov-0.2.0.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 Oct 29, 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.

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