generic-ml-cache-core
The hexagonal engine behind gmlcache — embeddable and stateless
The reusable hexagonal kernel 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, and the port contracts — zero runtime dependencies.
Concrete infrastructure (SQLite, filesystem blob store, ML client runners, API adapters,
metrics, clock, fingerprinting) lives in
generic-ml-cache-adapters.
Pure Python and stateless: it bakes in structure (table names, blob naming, schema) but no location — you inject the data source.
Part of a single-user, local tool — not a gateway. gmlcache records and replays across the subscriptions and APIs you already hold; it is not a multi-user router. See Positioning.
Install
pip install generic-ml-cache-core
Embed it
generic-ml-cache-core provides the ports and use cases. Pair it with
generic-ml-cache-adapters
for the shipped infrastructure, then wire them in your composition root:
from generic_ml_cache_core import WiredUseCases
from generic_ml_cache_core.application.port.inbound.run_ml_execution_command import (
RunMlExecutionCommand,
)
# wired: WiredUseCases — constructed by your composition root (see adapters package)
command = RunMlExecutionCommand(
execution_kind=ExecutionKind.LOCAL_MANAGED,
client="claude", model="claude-sonnet-4-5", effort="", context="", prompt="…",
)
execution = wired.run_ml.execute(command) # records on a miss, replays on a hit
Need a different store? Implement the ports from generic_ml_cache_core.application.port
and pass your own adapters. The core never imports any concrete implementation.
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. - Adapter registry — discovers and registers adapters declared via the
gmlcache.adaptersentry-point group at runtime. WiredUseCases— typed container of wired use-case references (constructed by the composition root in the adapters or CLI package).
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
Release files for generic-ml-cache-core 0.28.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| generic_ml_cache_core-0.28.2.tar.gz | 79.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| generic_ml_cache_core-0.28.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 182.1 kB
Release files / generic_ml_cache_core-0.28.2.tar.gz
| Download URL | generic_ml_cache_core-0.28.2.tar.gz |
|---|---|
| Size | 79.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
496707fcdebcb5cd930c9db4fbb5a1dc5da4e1618174f3c133c56821cbbdd0ea
|
|
BLAKE2b-256 checksum How to use checksums |
2fc3571f3c598697a0bccdb19b69d69e40da9dfe9d0fc75c22f29c178d646356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.
Transparency logRelease files / generic_ml_cache_core-0.28.2-py3-none-any.whl
| Download URL | generic_ml_cache_core-0.28.2-py3-none-any.whl |
|---|---|
| Size | 102.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb9dd9a0578f390cf8d61051660b39b8dfb142474f9230171b764399321d4938
|
|
BLAKE2b-256 checksum How to use checksums |
fe1907b56e6db02730c258b3aa46fe73096b86fea62db903e629cbb9597f192a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.
Transparency log