Files
paperspec/CONTRIBUTING.md
T
alexmandClaude a4eecb4d5b refactor: move the reference implementation to src/paperspec
The oracle had two import names, `tools.oracle` for the tools and
`paperspec` for other repositories, which could load the same code twice
in one process and needed a gate keyed on the module name. It now lives
in the standard src layout under its one name.

- git mv tools/oracle -> src/paperspec; the 22 rule modules are unchanged.
- The tools import `paperspec`. `tools/__init__.py` now holds the Python
  3.14 and cryptography/jsonschema check and puts src/ first on sys.path,
  so the tools run this checkout's code with or without pixi. The
  package's own __init__ checks nothing and exposes __version__.
- pyproject.toml: version from git tags via setuptools-scm
  (guess-next-dev, node-and-timestamp, src/paperspec/_version.py,
  gitignored). The packages stay listed rather than found because
  schemas/, sql/ and vectors/ stay at the root: the spec links to them and
  the site serves the schemas at their $id URLs.
- pixi.toml: a `dev` feature and environment with setuptools,
  setuptools-scm and python-build, and `pixi run -e dev wheel`.
- check.py scans src/paperspec for rule IDs; README, CONTRIBUTING, the
  FAQ, the overview, the vectors and tools READMEs and the changelog point
  at the new path. The FAQ no longer says the oracle is not a library.

pixi.lock is not re-solved in this commit: with a dynamic version, pixi
builds the package metadata to lock, which needs the conda environment
installed. Run `pixi lock` and commit the result before pushing; the site
workflow installs with --locked.

pixi run check passes; no computed value, vector, fixture, schema or SQL
file changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:00:40 -04:00

4.1 KiB

Contributing

This page is for anyone who wants to fix the specification, change a format or add an example. Propose a change as a pull request on the repository at https://git.scient.ing/infra/paperspec.

What a change needs

A change starts in the chapter of the specification that defines the rule, because the chapters are normative. The schemas, SQL, registries, vectors and fixtures then follow the chapter (spec/00 §0.5).

  1. Change the chapter. Say what is new in the chapter's own terms, and link the sections it touches.
  2. Change the schemas, SQL and registries that the rule shapes. A new refusal gets a rule ID in registry/rules.json.
  3. Compute, never type, the expected values. Change the oracle in src/paperspec/ to apply the rule, and add the case that shows it to tools/build.py: a vector, a fixture or a broken package in fixtures/invalid/. Then run pixi run build, which rewrites fixtures/ and vectors/.
  4. Run the checks. pixi run check must end with All checks pass. Without pixi, run python3 tools/check.py, with Python 3.14 and two packages, jsonschema and cryptography installed.
  5. Record the change in CHANGELOG.md.

Versions

A change that makes a valid file invalid, or that changes a computed value, is a breaking change and needs a new major version of the format, with a migration. Adding an optional property, a node kind, a run kind or an enumeration value is a minor change (spec/00 §0.3). A rebuild that changes any file under vectors/ or any hash in fixtures/ is a computed value changing, so say in the pull request why it must.

New node kinds and run kinds

Propose a kind with the vector or fixture that shows it. A node kind needs its row in chapter 3, the node schema, and its entry in the CHILDREN table of src/paperspec/model.py. A run kind needs its row in section 3.5 and the node schema, and its text in the plain projection (3.6) and in the strict and lossy projections (5.3, 5.5).

Releasing

A release is a tag on main whose version is the top heading of CHANGELOG.md. Before tagging:

  1. pixi run check passes on Linux and macOS, which the workflow in .gitea/workflows/ runs on every push. The check also confirms that every count the prose states (formats, schemas, vectors, broken packages) matches the repository, and that pixi.toml, the registries and tools/build.py state the same version.
  2. python3 tools/stress.py passes with its default seed, and with one or two others.
  3. The website is published from the release (deploy/), and the JSON-LD context at https://paperspec.scient.ing/context/scienting-1.jsonld and a schema at its $id both answer with their media types. Layers claim to be W3C Web Annotations, and a JSON-LD processor that cannot fetch the context cannot read them.
  4. The decisions that freeze on release are made: enumeration values and format identifiers never change meaning afterwards (spec/22 §22.5), so a name worth changing is changed now.
  5. The CHANGELOG entry describes the release in the terms of the chapters it touches.

Writing

The checker enforces two rules on every Markdown file: one sentence per line, and US spelling. pixi run lint runs markdownlint with the repository's settings. Define each term where it first appears, because the guides and READMEs are written for newcomers as well as implementers.

All fixture text is synthetic, written for the fixtures. The keys in fixtures/keys/ are public test keys and must never sign anything else.

Licenses

Each path keeps the license that LICENSE.md gives it: prose CC-BY-4.0, the normative data CC0-1.0, and tools/ Apache-2.0.