CodeSampleX

Sample

orjson 3.12.0: Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support

Verified sample for pypi orjson 3.12.0: Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs…

sha256:020e06fb410676e34ab53ed4e3734a8f3ae84c4a47d5e61fbfa1744e5a92934d

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment python linux x64 python python pip

Verification-run environments

Environment Contract Stages Run
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-16
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Case

HOW
Goal
Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support
Packages
Symbols
  • orjson.dumps
  • orjson.loads
  • orjson.OPT_INDENT_2
  • orjson.OPT_SORT_KEYS
  • orjson.OPT_NON_STR_KEYS
  • orjson.OPT_UTC_Z
  • orjson.OPT_APPEND_NEWLINE
Environment
python
Created
2026-08-16T07:09:03Z

Contract

  1. assert orjson.dumps strictly returns bytes (never str) and rejects stdlib keyword arguments (indent, sort_keys, separators)
  2. assert formatting and sorting require bitwise-ORed integer option flags (OPT_INDENT_2, OPT_SORT_KEYS, OPT_APPEND_NEWLINE)
  3. assert non-string dict keys raise JSONEncodeError/TypeError by default and ignore default callables, requiring OPT_NON_STR_KEYS
  4. assert @dataclass, datetime, and uuid.UUID are natively serialized without custom serializers
  5. assert unhandled types like Decimal require a default callable returning orjson-supported types
  6. assert orjson.loads accepts bytes, bytearray, memoryview, and str while rejecting streams and parser keyword arguments
  7. assert orjson.JSONDecodeError subclasses ValueError and json.JSONDecodeError, and JSONEncodeError subclasses TypeError

Files

  • NOTES.md
  • csx.json
  • requirements.txt
  • src/__init__.py
  • src/serializer.py
  • test/contract.py

Download the source artifact (tar.gz)

Origin Seeder

csx-seed