| doc_radar |
|
|---|
An accelerated Python standard library for hot-path operations.
unstd accelerates serialization, compression, deep copying, hashing, and other hot paths with bundled native code, optional backends, and familiar Python APIs.
Supports Python 3.12–3.15, including Python 3.15.2. The base install has no third-party runtime dependencies.
python -m pip install unstd
# Add accelerated serialization and compression backends:
python -m pip install 'unstd[serde,compress]'Install only the extras you need. Compatible CPython wheels include bundled C extensions; source builds use them when a compiler is available and retain portable fallbacks otherwise.
Linux CPython wheels also accelerate fs.atomic_write
without an extra dependency, while retaining the complete Python fallback.
from unstd import clone
from unstd.compress import gzipx
from unstd.serde import jsonx
payload = {"events": [{"name": "saved", "count": 1}]}
text = jsonx.dumps(payload) # str; stdlib JSON defaults and formatting
raw = jsonx.dumpb(payload) # bytes; compact UTF-8 JSON
copy = clone.deep(payload) # independent mutable copy
packed = gzipx.compress(raw, mtime=0)
restored = jsonx.loads(gzipx.decompress(packed))To migrate existing JSON calls, use from unstd.serde import jsonx as json.
For large JSON arrays, use jsonx.iterload(source) to process one record at a
time and jsonx.dump_array(records, destination) to export a generator with
bounded memory. See the read guide,
write guide, and
read measurements and
write measurements.
| Operation | Module | Optional extra |
|---|---|---|
| JSON, Base64, NDJSON, typed codecs | serde |
serde |
| Deep copying and dataclass conversion | clone |
None |
| Persistent JSON caching, atomic batches, TTLs, and parallel fills | cache |
None |
| Indexed JSON corpora, ordered selection, and bounded batches | dataset |
None |
| Gzip/zlib streams, Zstandard, archive bindings | compress |
compress, zstd, archives |
| UUIDs and BLAKE3 hashing | ids, crypto |
ids, crypto |
| Clocks, zoned time, Protobuf timestamp bridge | time |
time, proto |
| Validated models and settings | model |
model |
| Sorted collections and persistent mappings | containers |
containers |
| Regex and fuzzy matching | rex, text |
rex, text |
| Numeric frames, bulk packing and random draws | pack, rand |
pack, rand |
| Array reductions, vector scoring and grouping | math |
math |
| TOML writing and YAML parsing/editing | toml, yaml |
toml, yaml |
| Audio decoding, encoding, and streaming | audio |
audio |
| Atomic files, subprocesses, iteration | fs, proc, iters |
None |
The module index and individual guides describe backend requirements and fallback behavior.
Compatibility is defined per module. jsonx preserves stdlib JSON behavior,
including formatting, hooks, and errors, falling back when needed. Additional
helpers such as clone.deep and proc.run have their own documented contracts.
Gzip streams remain interoperable, but compressed bytes can differ by backend.
Without optional backends, modules use stdlib fallbacks where available;
capabilities without a faithful fallback raise ImportError. Some helpers,
including fuzzy matching and bulk randomness, can produce different results
across backends. Check the module guide before migrating.
Speed depends on your data, interpreter, platform, and installed backends. Profile your application and benchmark its actual hot paths. The benchmark guide provides reproducible comparisons and reports both gains and regressions.
See the test guide, architecture, API inventory, and security policy.
The 4.0.5 release notes cover the latest additions and improvements. The October 25 updates retain the change index through version 4.0.2.
First-party code is Apache-2.0; bundled licenses are listed in NOTICE.