alexmandClaude 516148146f feat: publish the package from CI, and clean up its references
Publishing
- .gitea/workflows/publish.yml publishes paperspec to the instance's PyPI
  registry (/api/packages/infra/pypi) when a v* tag is pushed: it checks
  the repository, builds the sdist and wheel, refuses to upload unless the
  built version equals the tag, runs twine check --strict, and uploads
  with the secrets PACKAGE_USER and PACKAGE_TOKEN (--skip-existing, so a
  rerun on the same tag is safe). Run by hand, it refuses anything but a
  tag.
- pixi dev environment: twine >= 6.1 (the first that reads Metadata 2.4),
  and `dist` (sdist and wheel) replaces the `wheel` task.
- deploy/README.md: how to set up the secrets, release a version, and
  install from the registry with pixi, uv or pip, tying paperspec to the
  registry where the installer allows it.
- CONTRIBUTING.md "Releasing": a tag versions the package; a format
  change takes the new format version as the top CHANGELOG heading, and a
  code-only release takes the next patch as a subsection, as 0.1.1 does.
- pyproject: fallback_version 0+unknown for source trees without git; the
  license expression is Apache-2.0 AND CC0-1.0, for the code and the data
  the wheel carries.

Cleanup (from an audit of every reference to the package)
- spec/00 lists src/ (the package) and tools/ (how to run it), and no
  longer says the reference implementation is not a library.
- Stale explanations fixed in pixi.toml, .gitignore, the Caddyfile, the
  vectors, context, sql and tools READMEs, docs/examples.md, docs/faq.md,
  spec/01, docs/rationale.md and docs/comparison.md: the commands, what
  they need (the tools extra), the fixture folder hale2026harmonic-damb,
  and three lines that held two sentences.
- tools/README.md counts all six commands, says what needs which extra
  (package.validate and corrections.gate need [schema]), and that the
  vectors ship but the fixtures they name do not.
- The CLI's install and clone hints point at the registry instructions and
  an https clone URL; schema.py raises an ImportError naming
  paperspec[schema], as crypto.py does for [crypto].
- check's Unicode check now guards the package's pinned constant.
- site skips build/, dist/ and *.egg-info.
- CHANGELOG 0.1.1 describes the final state.

pixi run check passes (as `python -m paperspec check`); the rebuild is
byte-identical. pixi.lock needs `pixi lock` for twine before pushing: the
publish workflow installs with --locked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:41:26 -04:00
2026-10-12 07:55:22 -04:00
2026-10-11 23:45:29 -04:00
2026-10-15 09:18:55 -04:00

paperspec

The data formats for storing a team's scientific papers once, correcting them once, addressing them down to the sentence, and keeping them.

This page is for three readers. A newcomer should read straight through; each term is explained where it first appears. The tables below point an implementer, who will write a reader, writer, converter or checker, to the chapters, test vectors and fixtures that define exact behavior. The sections on status and on differences give an expert in the neighboring standards the version, the maturity of each format and the comparison. The documentation and every file of the specification are published at https://paperspec.scient.ing, and the repository is at https://git.scient.ing/infra/paperspec.

A research team usually cares about a few dozen papers it understands completely, not the world's literature. Those papers deserve better than a folder of PDFs. Every sentence, table cell and equation should have a permanent address, and every correction should be recorded with its evidence. Notes, claims and extracted numbers should point at exactly what they came from. Anyone should be able to see how far each piece was checked, and by whom.

This repository defines the files that make that possible. It holds no application. Every format is documented here and readable without any program's code, so a reader, writer, converter, checker or store can each be a separate program. Every file is JSON (a plain-text format for structured data) or JSON Lines (one JSON record per line). A package is the unit these formats store a paper in: a folder or a zip file of such files holding the text as nodes (sections, sentences, cells, equations), page geometry, references, corrections, review receipts and the list of suspects (spec/12).

cornell1995second-saqk#k3m9q2a@4f1a0c[12:57]
└────── document ────┘└ node ┘└ pin ┘└span┘

A hash is a short fingerprint computed from text: the same text always gives the same fingerprint, and changing one character changes the hash. The string above names code points 12 to 57 of one sentence, as it read when its hash began 4f1a0c. The node ID k3m9q2a encodes no page, position or kind. It is minted once from the document key, the node's kind, its text hash and its occurrence, and then frozen. The document key's last four characters, saqk, are the start of a hash of the paper's DOI, so two papers that a citation key alone would name alike never share a key (spec/02 §2.4).

Fixing a typo elsewhere in the paper leaves the ID alone, and converting the same input again mints the same IDs. A teammate's download of the same PDF, stamped differently by the publisher, has the same page fingerprints. If a different converter reads the paper, each sentence it reads identically keeps its ID. Every difference becomes a suspect, a place flagged for review. Nothing changes until a correction with its evidence is accepted (spec/04, spec/05 §5.6). The address grammar is in spec/06 §6.1, and vectors/addresses.jsonl holds valid and invalid examples.

Start here

If you want to Read
Understand what the project is and how the parts fit docs/overview.md
Learn the ideas one at a time, each with an example docs/concepts.md
Follow one paper from its first reading to a signed document docs/walkthrough.md
Run something in the next five minutes docs/examples.md
Implement a reader or writer spec/, then vectors/
Know why a rule is the way it is docs/rationale.md
Look up a term docs/glossary.md
Compare with neighboring standards docs/comparison.md

What is in the repository

Folder Holds
spec/ The specification, in 24 chapters. Normative.
schemas/ JSON Schemas, which state what a valid file or record looks like, for every file and record.
sql/ Tables for SQLite (a database kept in one file), Dolt and PostgreSQL, and the SQLite bundle with full-text search.
context/ The JSON-LD context (a file that gives JSON terms shared meanings) that makes annotation layers W3C Web Annotations.
registry/ The list of formats, the rule IDs validators report, download-stamp rules, and the default rights each processing stage requires.
vectors/ Test vectors: inputs and the exact outputs every implementation must compute.
fixtures/ Example packages and records, deliberately broken packages, and the test keys that signed them.
tools/ How to run the commands that build and check everything above.
src/paperspec/ The reference implementation of every rule and those commands, installable as the Python package paperspec.
docs/ Guides for people getting to know the project.
deploy/ How the website at https://paperspec.scient.ing is built and served.

Try it

With pixi, one command sets up a pinned environment and checks everything:

pixi run check

The checker validates every schema, record and package. It confirms that every broken package is refused for the stated reason. It recomputes every test vector, and it rebuilds everything and compares it byte for byte. Last, it loads every package into SQLite and back, and checks the prose and the links. Pixi lints the Markdown first. The run ends with All checks pass. pixi task list shows the other tasks: quick, build, lint, load, validate and stress. pixi run site builds the website into _site/ (deploy/).

The commands need Python 3.14 and the package's tools extra (jsonschema, referencing and cryptography), which pixi installs along with markdownlint for the Markdown. Without pixi, install the checkout as the package with pip install -e ".[tools]" on Python 3.14, then run paperspec check. paperspec --help lists the commands, and each command's --help gives advice and examples (tools/).

To explore a worked package, load the example paper (a synthetic chemistry paper with 12 corrections) into SQLite and query it; docs/examples.md has queries to start from.

pixi run load --sqlite lab.db fixtures/packages/hale2026harmonic-damb

Format names

Every format is named scienting-<name>/<major>, such as scienting-doc/1 or scienting-anchor/1. The scienting- prefix is the formats' namespace, a separate matter from the repository's name. A format is named after what it holds, never after a product or a repository, and products can be renamed without touching data. Schemas use the identifier base https://paperspec.scient.ing/schemas/. registry/formats.json lists every format with its media type, schema, status and chapter.

Status and limits

This is version 0.1.0. Of the 32 formats, 19 are candidate and 13 are provisional. The provisional formats are project, bundle, dataset, digitization, view, snapshot, draft-ids, exercise, submission, grade, checklist, log-entry and checkpoint; where those are described, they are marked as such. The repository includes a reference checker, test vectors and fixtures.

The formats are built for a team-scale corpus of hundreds of documents, not hundreds of millions of papers. They do not replace publisher interchange formats. They do not fix what a converter reads wrongly; they record it and make it checkable. Not every addressable thing is a node with five hashes (the content values text_hash, match_hash, align_key, own_hash and node_hash, explained in docs/concepts.md). Table columns and figure-text items have IDs and are not nodes (spec/04 §4.2, spec/09).

How it differs from neighboring standards

  • JATS is the XML format in which publishers and archives exchange journal content (NISO Z39.96-2024). Keep using it for exchange. Here, a JATS file is one kind of reading a package can be established from (jats is a witness kind, spec/02 §2.3).
  • TEI has a sentence element, <s> (TEI P5), and recommends author-assigned xml:id values for durable pointers (TEI P5 pointers). Here, node IDs are minted by a rule and, when a node is merged or deleted, retired with a recorded successor (spec/04 §4.3).
  • W3C Web Annotation is a general model for annotating any resource, with text quote, text position and other selectors (W3C Recommendation). Use it for annotation in general. Here, annotation layers are Web Annotations whose target selector is a custom AnchorSelector, optionally followed by a standard TextQuoteSelector for tools that do not know ours (spec/18).
  • Docling is an open-source document conversion toolkit (arXiv:2501.17887). Use a converter like it to read PDFs. It identifies items by position in a list, such as #/texts/12 (schema). Here, IDs do not depend on position, and a second converter's reading is aligned with the first and compared.

Licenses

The specification and other prose are CC BY 4.0, so anyone may implement the formats. Schemas, SQL, the JSON-LD context, the registries, the vectors and the fixtures are CC0 1.0. The code, the paperspec package in src/ with its commands, is Apache-2.0. See LICENSE.md.

S
Description
The data formats for storing a team's scientific papers
https://paperspec.scient.ing/
Readme
1.7 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%