Skip to main content

crosswalk-codec

The Python package of crossmap, a bidirectional crosswalk codec. One crosswalk document describes how to map between a dataset's native JSON shape and a shared target shape, and that one document derives both directions: decode undoes encode over the paths the crosswalk maps, and what cannot be undone is declared as one-way rules. The codec is the Rust crate, built into one wheel per platform against CPython's stable ABI, so a wheel installs on CPython 3.11 and every later version. The crosswalk format is documented in the crossmap README.

pip install crosswalk-codec
from crosswalk_codec import assert_round_trip, decode, encode, parse_crosswalk

crosswalk = parse_crosswalk(
    {
        "source": "field-sensors/reading",
        "target": "observations/v1",
        "rules": [
            {"op": "move", "from": "rows[].sensor", "to": "observations[].deviceId"},
            {"op": "scale", "from": "rows[].depthM", "to": "observations[].depthMm", "factor": 1000},
        ],
        "oneWay": [{"op": "drop", "from": "rows[].batteryPct", "direction": "encode"}],
    }
)

table = {"rows": [{"sensor": "S-01", "depthM": 3, "batteryPct": 91}]}
encode(crosswalk, table)
# {'observations': [{'deviceId': 'S-01', 'depthMm': 3000}]}

decode(crosswalk, encode(crosswalk, table))
# {'rows': [{'sensor': 'S-01', 'depthM': 3}]}: batteryPct was declared lossy

assert_round_trip(crosswalk, [table])

API

The names follow the npm package's and the Rust crate's in Python's spelling.

Name
parse_crosswalk(document) Parses a crosswalk document into an immutable Crosswalk (source, target, schema, to_dict() for the parsed form). Raises CrosswalkSyntaxError carrying every issue.
validate_crosswalk(crosswalk) The structural defects of the rule list as CrosswalkIssues, empty when it can execute.
encode(crosswalk, document), decode(crosswalk, document) Translate a document in either direction. A crosswalk is validated and prepared the first time it is used and kept prepared, so translating many documents with one Crosswalk validates it once.
compile_crosswalk(crosswalk) Validates and prepares now, raising CrosswalkStructureError here, and returns a CompiledCrosswalk with encode(document) and decode(document).
assert_round_trip(crosswalk, samples) Encodes and decodes each sample and raises RoundTripMismatchError at the first difference, leaving out the paths one-way rules touch.
rule_sides(rule) The from_ and to paths of a two-way rule, such as an element of crosswalk.to_dict()["rules"].
json_schema_text() The crosswalk format's JSON Schema 2020-12 document as text, byte for byte the crossmap/schemas/crossmap.schema.json the npm package of the same version ships.

Every error the codec raises is a CrossmapError: CrosswalkSyntaxError and CrosswalkStructureError carry issues (SyntaxIssue(message), CrosswalkIssue(rule_index, message)), RuleApplicationError carries rule_index, path and detail, and RoundTripMismatchError carries sample_index, path and detail. A when predicate that cannot be evaluated at all (a lookup node, or a collection that is not an array of records) raises ValueError, as the npm package throws a plain Error there.

The package installs the crossmap command, the same command the npm package installs, documented in the crossmap README.

Documents and numbers

Documents are native Python values: dict with str keys, list, str, int, float, bool and None, and their subclasses. Anything else raises TypeError, naming where it is in the document: a tuple, a set or bytes is refused rather than turned into something else, since decode could not give it back. A document is converted once on the way in and once on the way out, straight to and from the codec's own value, never through JSON text, and the interpreter is released while the codec runs.

A JSON number is an IEEE double, as JavaScript's JSON.parse reads it, so numbers convert by their value as a double:

  • An int is accepted when a double has exactly its value: every integer of magnitude up to 2^53, and larger ones a double holds exactly. Any other int raises ValueError rather than being rounded, where JSON.parse would round the same digits to the nearest double. A float is accepted when it is finite; NaN and the infinities raise ValueError, since JSON cannot write them.
  • A number comes back as an int when it is a safe integer (integral with magnitude at most 2^53 - 1, as Number.isSafeInteger defines it) and as a float otherwise. So 3, 3.0 and 3e0 all come back as 3, which is what json.loads gives for the text JSON.stringify writes for each of them, and 2.5 and 1e300 come back as float. Negative zero comes back as the float -0.0, keeping its sign.

Records keep their key order, in the order a JavaScript object would list the same keys: keys that are array indices ("0", "17") first in numeric order, then the others in insertion order. A document may nest 127 arrays and records, the root included, which is as deep as the crossmap command reads from JSON text; deeper nesting, or a container that contains itself, raises ValueError.

MIT licensed.

Metadata

Release files for crosswalk-codec 0.12.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crosswalk-codec 0.12.5
File Size Uploaded Provenance Actions
crosswalk_codec-0.12.5.tar.gz 124.9 kB With provenance Details for crosswalk_codec-0.12.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for crosswalk-codec 0.12.5
File Actions
crosswalk_codec-0.12.5-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for crosswalk_codec-0.12.5-cp311-abi3-win_arm64.whl
crosswalk_codec-0.12.5-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for crosswalk_codec-0.12.5-cp311-abi3-win_amd64.whl
crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_x86_64.whl
crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_aarch64.whl
crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_x86_64.whl
crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_aarch64.whl
crosswalk_codec-0.12.5-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for crosswalk_codec-0.12.5-cp311-abi3-macosx_11_0_arm64.whl
crosswalk_codec-0.12.5-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for crosswalk_codec-0.12.5-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 15.4 MB

Release files / crosswalk_codec-0.12.5.tar.gz

Download URL crosswalk_codec-0.12.5.tar.gz
Size 124.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ae62ced1d7867c6fef4a9423e77c8de6443c4818218ac5608f689164c233186b
BLAKE2b-256 checksum
How to use checksums
0a5529bc3336056e56ee28d8418af190ed6a7428d69735e3a7e81aa7465cf128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-win_arm64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-win_arm64.whl
Size 1.6 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
c156a37ad675120deb3e63b87c1b4b36089c1effecdf2b5f28d78e4c4b9a56bd
BLAKE2b-256 checksum
How to use checksums
784beb02969d722aa6a570aee6a6cae40908cd0afbc01beb3adcb2cacc409d0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-win_amd64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-win_amd64.whl
Size 1.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
344e28ee4973ca4147d1e374c08b79a09bc862a8b84892d05f1d42f604aff41a
BLAKE2b-256 checksum
How to use checksums
882a880942030f4db4ec0e6f3df3da59c67285e7aae7e8f9ba578caf148b7a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_x86_64.whl
Size 2.2 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
0310da9a13350b5ab1ccae5c0b40867f62e8fde6cf88ff007d8b4f313d907755
BLAKE2b-256 checksum
How to use checksums
2c403f89e3a8f9c994466f9f019ece69d199592ffbd00cc6d4670b8244fbb7ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-musllinux_1_2_aarch64.whl
Size 2.2 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
20b8b882fbf8eb43ebc4823cb15bb51a8b27c8d577f0ccd74f2d8ddc146da08f
BLAKE2b-256 checksum
How to use checksums
ae458e3ef508bc566983c2f65611e4a1656b16010d36cdcf9284a39f93fac9d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
31625706eb4708f6c042d3f230a20356dc62dbf509f7e8593fbcf4b11d4c5a7c
BLAKE2b-256 checksum
How to use checksums
d87b352b312af98fb85bb46f660edca293c96523099e8f7d8f2b6609838d8fdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-manylinux_2_28_aarch64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
4bd08f265e2c30cc62fc4a26f1b036fe9eb2d2b3690119d2deb8ebff776cf960
BLAKE2b-256 checksum
How to use checksums
b6db619c150c6dfec606c614f81b79f1c20484e8b76ac56d2bcbfc19c65611df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-macosx_11_0_arm64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2b0dde7e50e4c1e428afc45462f3db84dbd07a4e4ef1e8121d840d9777a5abf5
BLAKE2b-256 checksum
How to use checksums
f77b6492d20255935573719642be30e6360c870fe041fb6fdd0786f8cf617fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / crosswalk_codec-0.12.5-cp311-abi3-macosx_10_12_x86_64.whl

Download URL crosswalk_codec-0.12.5-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6abb5be91a81292c8be38b33ba14e8d3cf8a77583cd512f0a0b170966b34653e
BLAKE2b-256 checksum
How to use checksums
ccaa96c5aff9b09ee846f361dca3be00b4a6f9d1c61ae4e6266c15763fa9e674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for crosswalk-codec 0.12.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for crosswalk_codec-0.12.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page