Skip to main content

xdol

A toolkit for working with key-value stores (Extended Data Object Layers), built on dol. Record and replay costly calls, keep one mapping in sync with another, cap a fast store over a slow one, and register plugins in a typed dict.

pip install xdol

Documentation

Any MutableMapping works as a store: a dict, a folder of files, S3, a database, through dol. That is the difference from functools.lru_cache or joblib.Memory for memoization: the cache lives wherever your store does, and in replay mode a miss raises instead of quietly paying for the call.

from xdol import memoize_calls, update_with_policy

cache = {}


@memoize_calls(store=cache, mode="record")
def square(x):
    return x * x


assert square(3) == 9  # computed, and recorded in `cache`
assert square(3) == 9  # replayed from `cache`
assert len(cache) == 1

target = {"a": 1}
update_with_policy(target, {"a": 2, "b": 3})  # default: update keys whose values differ
assert target == {"a": 2, "b": 3}

What is in it

Module What it gives you
xdol.memoize memoize_calls: persistent memoization with record and replay modes, spend-safe by default (a miss in replay mode raises).
xdol.keys robust_key, make_key_func: stable, filesystem-safe cache keys from a call's inputs.
xdol.updating update_with_policy, backfill, reconcile, verify: controlled updates of one mapping from another.
xdol.tiering TieredStore: a bounded hot store over a cold source of truth (write-through, GDSF or LRU release).
xdol.access AccessStats, track_access: persisted, mergeable per-key access statistics for any store.
xdol.x_codecs Codec, get_codec, paired_store: object-to-bytes codecs, and stores that apply them.
xdol.registry Registry: a typed, dict-backed plugin registry with conflict rules.
xdol.pystores PyFilesReader, PkgReader: mapping views of a folder's or a package's .py files.
xdol.from_dol tools that left dol's top level (igroupby, ihead, trace_getitem, to_zip_file, ...).

Everything listed is importable from xdol directly.

Persistent memoizer (record/replay)

Wrap a costly function (a paid API, a slow render) so the first run records its result to disk and every later run replays it:

from xdol import memoize_calls


# A path string becomes a folder store. The default mode is replay-only: a miss raises.
@memoize_calls(store="tests/cassettes", mode="record")
def slow_square(x):
    return {"result": x * x}

Stable keys (xdol.keys), text / JSON / binary / paired .json+.bin codecs, any MutableMapping as the store (a folder, S3), spend-safe replay by default. See the persistent memoizer guide.

Metadata

Release files for xdol 0.1.45

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

Source distribution (sdist)

Source distribution for xdol 0.1.45
File Size Uploaded Provenance Actions
xdol-0.1.45.tar.gz 98.5 kB Without provenance Details for xdol-0.1.45.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xdol 0.1.45
File Interpreter ABI Platform Actions
xdol-0.1.45-py3-none-any.whl Python 3 none any Details for xdol-0.1.45-py3-none-any.whl

Total release size: 169.9 kB

Release files / xdol-0.1.45.tar.gz

Download URL xdol-0.1.45.tar.gz
Size 98.5 kB
Tags Source
SHA-256 checksum
How to use checksums
29c80e21a3941b121d362583a8c35aab3eeb5d8b0801ec54f3b7b28cd7691153
BLAKE2b-256 checksum
How to use checksums
e87c84e025e9240c14888565ddf2925478929cd7e3c5d561d73643a1e4df3ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / xdol-0.1.45-py3-none-any.whl

Download URL xdol-0.1.45-py3-none-any.whl
Size 71.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b7b85242e0d39c8d3845d0351cd81f4011c6d0f9966085fa68e5842b01b8a85
BLAKE2b-256 checksum
How to use checksums
7a8b954296429c7baaf88ac2b42f61e8967f39afed1026b40a4175295850f2e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for xdol 0.1.45

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.45 This release

2 release files No provenance

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