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.44

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.44
File Size Uploaded Provenance Actions
xdol-0.1.44.tar.gz 98.3 kB Without provenance Details for xdol-0.1.44.tar.gz

Built distribution (wheel)

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

Total release size: 169.7 kB

Release files / xdol-0.1.44.tar.gz

Download URL xdol-0.1.44.tar.gz
Size 98.3 kB
Tags Source
SHA-256 checksum
How to use checksums
77a586cfcf1ed59276dec5471b495e7975f650263e6fd0736df1941abec9ca7a
BLAKE2b-256 checksum
How to use checksums
6921408f515c7bd348ff26c9dfb6d0cbfa683da3ed6d50c4f396a760dcd92df1
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.44-py3-none-any.whl

Download URL xdol-0.1.44-py3-none-any.whl
Size 71.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be0b4a0689d948617f4d2ec9ad2d636a7f910d3a9ff62a6c4d702baded2510c0
BLAKE2b-256 checksum
How to use checksums
c6f2b172d43dd0962a8d324d404b2b13b298788307e60916fad60570e680d46a
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.44

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.44 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