Skip to main content

PAIRL v1.5 reference implementation — parser, validator, canonicalizer, and renderer

Project description

pairl (Python)

Reference implementation of the PAIRL v1.5 protocol: parser, validator (rules V1–V12), canonicalizer + SHA-256 hashing, and a deterministic human-readable renderer. Pure standard library, no runtime dependencies.

Install

pip install -e impl/python      # from the repo root

Library

import pairl

msg = pairl.parse(open("message.pairl").read())

res = pairl.validate(msg)            # rules V1–V12
print(res.valid, res.errors, res.warnings)

print(pairl.compute_hash(msg))       # canonical SHA-256 (columnar-invariant)
print(pairl.render(msg))             # faithful human-readable rendering

Columnar blocks (#evid[claim,src,conf] + positional rows, §3.4) are parsed and expanded to their canonical #type key=value records, so a message hashes identically whether sent in columnar or key=value form (§9.4a).

CLI

python -m pairl validate [--strict] message.pairl
python -m pairl render   message.pairl
python -m pairl hash     message.pairl
python -m pairl canon    message.pairl

Test

cd impl/python && python -m unittest discover -s tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pairl-1.5.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pairl-1.5.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file pairl-1.5.0.tar.gz.

File metadata

  • Download URL: pairl-1.5.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pairl-1.5.0.tar.gz
Algorithm Hash digest
SHA256 5c706c1dcf314089210e878d76bdeda0d9b0238ccd268d5088adb281236ff2d6
MD5 df26c7449a667e965c67cc909742c233
BLAKE2b-256 f585ec342a4fc34092ebadcbd230fde3c4ca26a8a7dc882b98d5f68278302b57

See more details on using hashes here.

Provenance

The following attestation bundles were made for pairl-1.5.0.tar.gz:

Publisher: release.yml on dwehrmann/PAIRL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pairl-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: pairl-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pairl-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11ddc3281cd3d07cd598d0f3c180a6aea584194284cfb5010b7d92267f7c9d5f
MD5 1f874d5467123f8c579a5b7112c87202
BLAKE2b-256 815f330f3bd58f92156fa84498efa7796b982925a6f56a9d858cfc5b9a8a3515

See more details on using hashes here.

Provenance

The following attestation bundles were made for pairl-1.5.0-py3-none-any.whl:

Publisher: release.yml on dwehrmann/PAIRL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page