CX · Reference guidecx-binding-python
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-binding-python

cxlib for Python

Why reach for it

The same C ABI, in the host's own idiom. This binding is cxlib on PyPI: a thin wrapper over libcx's string-in, string-out C ABI, so a program in the host language parses, canonicalises, hashes, converts and evaluates CX with the very engine the cx binary runs — byte-identical answers, nothing reimplemented.

Layer 1 is the contract every binding shares: sixteen canonical methods — parse, bytes, hash, equals, eval, select, modify and the node accessors — with identical semantics across hosts, so a document hashed here is the document hashed from anywhere else. Identity rides cx_canonical, cx_hash and cx_eq; selection, evaluation and update delegate to cx_code_eval; nothing about a document is retained inside libcx between calls. layer-1 is the table, c-abi the surface beneath it, layer-2 the host-idiomatic sugar above it — the idioms package — that desugars to Layer 1.

We grade the binding against the front door's published ABI vectors — one case per entry point a wrapper covers, an input document and the canonical output, hash or refusal it must answer — through the binding's own test, which loads the file from its pin and asserts every vector through its own wrapper. The same file is checked against libcx directly by the front door's C test, so the wrapper and the engine are held to one witness.

What it gives you

No CX module: a binding ships host code, not .cx files, so the table below is the generator's note. What it gives you is the package itself — the Layer-1 methods, and the idioms above them that desugar to Layer 1.

This repository ships no bundled module of its own; what it gives you is above, and its links are below.

Try it

One ABI vector, replayed by this site's cx: a document with a presentation comment, kept through cx_fmt — the lossless canonical text the wrapper's fmt answers. The binding's own test asserts the same vector through the wrapper; this page shows the engine's own answer.

input.cx

        # a note about the user
[user id=1 name="Alice"]
      
        $ cx --from=cx --to=cx input.cx
# a note about the user
[user id=1 name=Alice]
      

Fixture abi-001-fmt-lossless-retains-comment in deps/cx-core-code/conformance/abi.cxd — replayed against this cx when the page was built.

Status

The binding is not consumed by cx — it consumes cx: its own deps.cxd pins the front door for the C ABI and the V core it builds libcx from, which is why the registry row carries no at= and the figure draws no column on either side. It ships from its own repository at its own cadence, and a pin moves there only when the newer front door passes with it.

fact as the registry records it
ships as pypi
status extracted
pinned at 71971bbcf — the registry's at=; deps.cxd carries no row for it, so nothing of it is in the build
builds on none recorded — the registry row carries no pins= column yet
built on by nothing pins it yet
bundled modules 0
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY none recorded — no pins= on the registry row yet cx-binding-python no bundled module — see its row nothing pins it yet DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-binding-python plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built