Repository navigation
PyUnitWizard 0.27.0
PyUnitWizard 0.27.0 adds QuantityRecord, an inert interchange form for storing and exchanging quantities without ever losing or misreading their unit. The API is provisional until the 1.0 checklist promotes it.
Changes:
- New
"record"form (QuantityRecord,QuantityRecordBundle).- Values travel with their unit's canonical name and SI description (factor, offset, exponents), plus an optional field and quantity kind.
- A blake2b seal covers the unit description and the values' bytes.
- Reading refuses a missing manifest (there is no default unit), a broken seal, or a unit whose name and SI description disagree.
to_quantity()is the reader's handshake: field, unit, dimensionality and kind.- Encodings: strict JSON, which refuses NaN and infinity, and base64.
- It works with the generic API (
convert,quantity(..., form="record"),get_value,get_unit,get_dimensionality, …) and imports no backend at load time.
RecordError(PUW-ERR-REC-001) is added to the SMonitor catalog.- For third parties. A reference reader that uses only the Python standard library, and frozen test vectors (
tests/quantity_record_vectors/). - Documentation.
- "Quantity Records": what a record guarantees and how to use it.
- "Why QuantityRecord": the problem, and a comparison with unit libraries, OpenFF-style records, CF/UDUNITS, ASDF, container checksums, UCUM, QUDT/UO and D-SI.
- A new section of the canonical integration guide.
- Superseded draft.
devguide/serialization_contract_draft.mdis superseded; its safety rules and promotion gate are met.
Design record and alternatives: #83. Implementation: #82, #88.
Release evidence for commit e1a13d1461ea62b5986bd12d4f39b793438af607:
- The Linux/macOS × Python 3.11–3.14 full matrix (run 35980740956), release gates (run 35980744505) and MolSysSuite policy (run 35980741553) passed.
- The staged
0.27.0-py_0package (staging run 35981202084) passed producer-receipt verification and eight clean Conda installations across the same matrix (run 35981511091). Its SHA-256 is2102b1bd4e8188d4d150f90fcf093425d07fa2858993984016a6e7de10c3aaac. - A separate clean installation from staging on Linux/Python 3.13 reproduced all five published record vectors byte for byte, verified them with the reference reader, and refused a tampered record.
The exact staged file was promoted without rebuilding (run 35982009336) and verified on the public uibcdf/noarch channel with the same SHA-256. A clean Linux/Python 3.14 environment built from the public channels only installed that file and passed a QuantityRecord smoke test.
Install it with conda install -c uibcdf -c conda-forge 'pyunitwizard>=0.27.0'.