CodeSampleX

示例

orjson 3.11.9: Swap json for orjson on Alpine, without the wheel surprise or the silent output changes

已验证示例 — pypi orjson 3.11.9: Swap json for orjson on Alpine, without the wheel surprise or the silent output changes. contract 在 python 3.12 · linux…

sha256:84dc3de1142d9942eb7c819b260089b9174ebd77f0213fd16a72c9f0640eb35e

本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。 提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。 MIT-0

执行证据

声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。

证据依据
签名契约通过
验证回执
2
构建过它的签名密钥
2
声明的环境 python 3.12 linux · musl x64 python 3.12 python pip

验证运行环境

环境 契约 阶段 运行日期
python 3.12 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pypi@1
2026-08-14
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pypi@1
2026-08-18

案例

MIGRATION
目标
Swap json for orjson on Alpine, without the wheel surprise or the silent output changes
符号
  • orjson.dumps
  • orjson.loads
  • orjson.OPT_SORT_KEYS
  • orjson.OPT_NON_STR_KEYS
  • orjson.OPT_INDENT_2
  • orjson.OPT_UTC_Z
  • orjson.JSONEncodeError
  • orjson.JSONDecodeError
  • json.dumps
环境
python 3.12
创建时间
2026-08-14T08:53:26Z

契约

  1. assert pip took the musllinux wheel, orjson-3.11.9-cp312-cp312-musllinux_1_2_x86_64.whl, reconstructed from the recorded dist-info tag
  2. assert the distribution is a compiled extension, not pure Python, whose filename is this interpreter's own EXT_SUFFIX, and declares no runtime dependencies of its own
  3. assert the extension needs exactly one library, libc.so, and no file of that name exists under any directory the loader searches
  4. assert musl's loader resolves that name to itself, which is the only reason the extension imports
  5. assert no CPython library is linked, so the Py symbols are resolved from the interpreter that imports it
  6. assert the same ELF reader finds the versioned musl soname and libpython in the interpreter binary, so the reading is real
  7. assert the interpreter itself reports musl, with musl's loader present and glibc's absent
  8. assert orjson.dumps returns bytes where json.dumps returns str, with no separator spaces and no \uXXXX escaping
  9. assert OPT_INDENT_2 puts the space after the colon back and matches json.dumps(indent=2) byte for byte
  10. assert there is no orjson.dump or orjson.load, so writing to a file is the caller's job
  11. assert datetime, date, time and UUID serialize natively as RFC 3339 with +00:00 unless OPT_UTC_Z, where json raises TypeError
  12. assert orjson accepts default as its second positional argument and json.dumps refuses a positional there, the reverse of the usual warning
  13. assert every other json.dumps keyword is a TypeError, and sort_keys is instead option=OPT_SORT_KEYS with the same code point ordering
  14. assert orjson.JSONEncodeError is builtins.TypeError itself while JSONDecodeError is a real subclass of json.JSONDecodeError
  15. assert non-str dict keys raise unless OPT_NON_STR_KEYS, while json coerces them silently and loses a value when two keys collide
  16. assert nan and infinity serialize as null with the default hook never consulted, while json emits tokens orjson then refuses to read back
  17. assert a walk over the payload finds the non-finite floats orjson will not report
  18. assert a non-finite Decimal raises instead of vanishing, until a default hook floats it and it becomes null too
  19. assert integers outside -2**63 through 2**64-1 raise where json prints them

文件

  • csx.json
  • requirements.txt
  • src/__init__.py
  • src/serialize.py
  • src/wheel.py
  • test/contract.py

下载源代码构件 (tar.gz)

原始种子者

anonymous