Content-addressed caching middleware for Styx
Project description
styxcache
Content-addressed caching middleware for Styx runners.
Wraps any Styx Runner (docker, podman, singularity, local, ...) and persists
tool outputs in a content-addressed cache directory. Subsequent invocations with
identical inputs (file contents, parameters, wrapper version, container image
digest) skip execution and reuse the cached output tree directly.
Usage
from styxdefs import set_global_runner
from styxdocker import DockerRunner
from styxcache import CachingRunner, CachePolicy
from styxcache.backends import docker_digest_resolver
set_global_runner(
CachingRunner(
base=DockerRunner(data_dir="/tmp/styx"),
cache_dir="/mnt/ci-cache/styx",
policy=CachePolicy(image_digest=docker_digest_resolver),
)
)
# Use any Styx wrapper as usual; repeated calls with the same inputs are cached.
How the key is computed
sha256(
metadata.id,
metadata.package,
metadata.name,
image_digest,
sorted(env_allowlist_values),
params_dict_with_input_paths_replaced_by_content_hashes,
)
metadata.id— fingerprints the wrapper version; changes when the wrapper changes.image_digest— resolves the container image tag to an immutable digest.params_dictis walked recursively; any value matching a path passed toexecution.input_file()is replaced with the blake3 hash of that file (or directory tree, whenresolve_parent=True).- Input file hashing uses blake3 (fast, cryptographic, parallelizable).
Output location
execution.output_file("out.nii") returns cache_dir/<key>/out.nii directly.
The cache directory is the output tree, so downstream consumers of the
returned paths read from the cache with no additional materialisation step.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file styxcache-0.1.0.tar.gz.
File metadata
- Download URL: styxcache-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ad012669bd1839d4aa6c58c0457bf0a17525e00d8ceb8750137502f84ac1e8
|
|
| MD5 |
1a27f4217bbd572f5b233f89813cc068
|
|
| BLAKE2b-256 |
5899cef455e2612dd56ae1a1ba4227c4c453258844cc2217be779343463e9b17
|
File details
Details for the file styxcache-0.1.0-py3-none-any.whl.
File metadata
- Download URL: styxcache-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9838cd15c1663475944c18dc3b950ffdaa4ef7541857bc29bbd32f6fb799222
|
|
| MD5 |
e3f7d0795a4b4edb86af31efbed2202f
|
|
| BLAKE2b-256 |
22cfb89e05705e815666eed4caef12dcdb19562e1aff89abe406ede55795c664
|