Hexagonal core library for generic-ml-cache: domain, use cases, ports, and the default outbound adapters (SQLite repo, blob store, local clients, API). Stateless; inject the data source. Zero runtime deps.
Project description
generic-ml-cache-core
The hexagonal engine behind gmlcache — embeddable, stateless, dependency-free
The reusable engine behind
gmlcache:
record a real ML client (or API) call once, replay it by its content key. It contains
the domain model, the use cases, the port contracts, and the default outbound
adapters (SQLite execution repository, filesystem blob store, the
claude/codex/cursor client runner, the API client, metrics, clock, fingerprinting) —
plus the build_use_cases composition factory.
Pure Python, zero runtime dependencies, and stateless: it bakes in structure (table names, blob naming, schema) but no location — you inject the data source.
Install
pip install generic-ml-cache-core
Embed it
Hand the library a data source and it wires the engine for you:
from generic_ml_cache_core import build_use_cases
from generic_ml_cache_core.application.port.inbound.run_managed_local_execution_command import (
RunManagedLocalExecutionCommand,
)
wired = build_use_cases(store_root="/path/you/choose") # you provide the data source
command = RunManagedLocalExecutionCommand(
client="claude", model="sonnet", effort="", context="", prompt="…",
)
execution = wired.run_managed.execute(command) # records on a miss, replays on a hit
You reuse the shipped adapters by injecting a data source — you never reimplement them (the Spring Batch model: the framework ships the writers, you provide the connection). Need a different store? Construct the use cases yourself against the ports and pass your own adapter.
What's inside
- Domain model — executions, polymorphic call identities, artifacts, usage.
- Use cases — managed-local / passthrough / API runs, and probe (check).
- Ports (
application/port/...) — client runner, blob store, execution repository, metrics, clock, fingerprint, API client. - Default adapters (
adapter/out/...) + thebuild_use_casescomposition factory. generic_ml_cache_core.testing.InMemoryExecutionRepository— a dependency-free reference adapter to test your code against the ports.
Inbound drivers —
gmlcache
today, a daemon later — map their surface (a terminal, a REST API) onto these public
APIs; the core itself has no UI and reads no config file.
Links
- Repository & docs: https://github.com/danielslobozian/generic-ml-cache
- Changelog (both packages, versioned in lockstep):
CHANGELOG.md - Security policy:
SECURITY.md
License
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 generic_ml_cache_core-0.2.0.tar.gz.
File metadata
- Download URL: generic_ml_cache_core-0.2.0.tar.gz
- Upload date:
- Size: 86.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f7306ae20b00ba9c911922766f1c6b02f655b48c891d5b0dde4337d8fa40ae8
|
|
| MD5 |
082fb57ef3be15b9b15394b19df3dc9b
|
|
| BLAKE2b-256 |
362c160791609573aa6e2c85f0b4a2c1a7ed1e9d2759ad93eb9231e15bfa9f7d
|
Provenance
The following attestation bundles were made for generic_ml_cache_core-0.2.0.tar.gz:
Publisher:
release.yml on danielslobozian/generic-ml-cache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generic_ml_cache_core-0.2.0.tar.gz -
Subject digest:
3f7306ae20b00ba9c911922766f1c6b02f655b48c891d5b0dde4337d8fa40ae8 - Sigstore transparency entry: 1904271151
- Sigstore integration time:
-
Permalink:
danielslobozian/generic-ml-cache@f60146ebd30a3b723fd4a94c51137127d1c13cae -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/danielslobozian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f60146ebd30a3b723fd4a94c51137127d1c13cae -
Trigger Event:
push
-
Statement type:
File details
Details for the file generic_ml_cache_core-0.2.0-py3-none-any.whl.
File metadata
- Download URL: generic_ml_cache_core-0.2.0-py3-none-any.whl
- Upload date:
- Size: 103.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3edc615c598e36a5bce14addae54b0c98360758bc15c3bb12a1fc2cbebd0fdb4
|
|
| MD5 |
ffe1db5f26be198104d17fb000560d3c
|
|
| BLAKE2b-256 |
4c3d2704a0bdf8be419e8b671b0ebf9ec14f22e4aada876524bed15b95c00b40
|
Provenance
The following attestation bundles were made for generic_ml_cache_core-0.2.0-py3-none-any.whl:
Publisher:
release.yml on danielslobozian/generic-ml-cache
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generic_ml_cache_core-0.2.0-py3-none-any.whl -
Subject digest:
3edc615c598e36a5bce14addae54b0c98360758bc15c3bb12a1fc2cbebd0fdb4 - Sigstore transparency entry: 1904271219
- Sigstore integration time:
-
Permalink:
danielslobozian/generic-ml-cache@f60146ebd30a3b723fd4a94c51137127d1c13cae -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/danielslobozian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f60146ebd30a3b723fd4a94c51137127d1c13cae -
Trigger Event:
push
-
Statement type: