Skip to main content

gmlcache

generic-ml-cache-core

The hexagonal engine behind gmlcache — embeddable and stateless

License: Apache 2.0 Status: Alpha

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

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/...) + the build_use_cases composition factory.
  • generic_ml_cache_core.testing.InMemoryExecutionRepository — an in-memory 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

License

Apache-2.0 — see LICENSE and NOTICE.

Release files for generic-ml-cache-core 0.20.0

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

Source distribution (sdist)

Source distribution for generic-ml-cache-core 0.20.0
File Size Uploaded
generic_ml_cache_core-0.20.0.tar.gz 152.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for generic-ml-cache-core 0.20.0
File Interpreter ABI Platform
generic_ml_cache_core-0.20.0-py3-none-any.whl Python 3 none any Details

Total release size: 310.0 kB

Release files / generic_ml_cache_core-0.20.0.tar.gz

Download URL generic_ml_cache_core-0.20.0.tar.gz
Size 152.8 kB
Tags Source
SHA-256 checksum
How to use checksums
921421ad6105f9fc62cc02e9f775fa7d7a4aa38ae9d5d0756e174a2be598d0d4
BLAKE2b-256 checksum
How to use checksums
c5e825253dd5473d5130409f6a944c1b26202cd9eaae1833bb4bdde4e9a76e19
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 28, 2026.

Transparency log

Release files / generic_ml_cache_core-0.20.0-py3-none-any.whl

Download URL generic_ml_cache_core-0.20.0-py3-none-any.whl
Size 157.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83a14ec3f20067e6cd53682e3d43a03053a7a16fbb3e73f2a53c4f3822a335f5
BLAKE2b-256 checksum
How to use checksums
f72fe08ec33d01ddfccadfed797c592d7ca367adf84c4b89b091d39c5bcf1bbf
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 28, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.0

2 release files

0.28.2

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

This release

0.20.0 This release

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

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