Skip to main content

**Unified ingestion, caching, and audit layer for Money Ex Machina.**

Project description

mxm-dataio

Version License Python Checked with pyright

Purpose

mxm-dataio provides a unified ingestion, caching, and audit layer for the Money Ex Machina ecosystem.

It records every external interaction (Session → Request → Response), persists exact payload bytes, and stores structured metadata in SQLite.

The system is designed for deterministic reproducibility, offline caching, and transparent data provenance.

Installation

pip install mxm-dataio

Usage

Basic session usage

from mxm.dataio.api import DataIoSession
from mxm.dataio.adapters import HttpFetcher
from mxm.config import load_config
from mxm.dataio.config.config import dataio_view

cfg = load_config(package="mxm-dataio", env="dev", profile="default")
dio_cfg = dataio_view(cfg)

with DataIoSession(source="http", cfg=dio_cfg) as io:
    req = io.request(kind="demo", params={"q": "mxm"})
    resp = io.fetch(req)
    print(resp.status, resp.checksum, resp.path)

Fetch and cache a resource

session = DataIoSession(cfg=dio_cfg)
result = session.fetch("https://example.com/data.json", fetcher="http")
print(result.status_code)

Send data to an API

result = session.send("https://api.example.com/upload", data=b"...", sender="http")
print(result.status_code)

Overview

mxm-dataio is a lightweight ingestion and audit backbone.

It provides:

  • deterministic request identity
  • persistent raw payload storage
  • structured metadata in SQLite
  • adapter-based I/O abstraction

Architecture

mxm-dataio/
├── DataIoSession
├── Request / Response
├── adapters/
└── store/

Each interaction:

Session ─┬─> Request ──> Response
         └─> Request ──> Response

Storage layout:

<root>/responses/<session>/<hash>.json
<root>/blobs/<session>/<hash>.bin

Core model

Concept Role
Session Groups related requests
Request Deterministic operation identity
Response Archived payload + metadata
Adapter I/O implementation
Registry Adapter mapping

Configuration

Configuration is loaded via mxm-config and read from the dataio subtree.

Default seed location:

src/mxm/dataio/_data/seed/dataio/

Adapters

Adapters implement fetch/send logic while mxm-dataio handles persistence.

from mxm.dataio.adapters import BaseFetcher
from mxm.dataio.types import AdapterResult
import requests

class HttpFetcher(BaseFetcher):
    def fetch(self, url: str, **params) -> AdapterResult:
        r = requests.get(url, params=params)
        return AdapterResult(
            payload=r.content,
            meta={"url": r.url, "headers": dict(r.headers)},
            content_type=r.headers.get("content-type"),
            status_code=r.status_code,
        )

Caching and Provenance

Supports policy-driven caching:

  • volatile vs eternal data
  • TTL-based expiry
  • reproducible snapshots

Example provenance:

{
  "_provenance": {
    "checksum": "sha256:…",
    "fetched_at": "2025-10-27T10:45:12Z",
    "cache_mode": "default"
  }
}

Design principles

  • Deterministic
  • Auditable
  • Minimal dependencies
  • Composable
  • Human-readable storage

Development

make check

This runs:

  • Ruff (lint + imports)
  • Black (format)
  • Isort (consistency)
  • Pyright (typing)
  • Pytest (tests)

Roadmap

  • Async adapters
  • Multi-backend storage
  • Delta auditing improvements
  • CLI for inspection

License

MIT License. See 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

mxm_dataio-0.4.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mxm_dataio-0.4.2-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file mxm_dataio-0.4.2.tar.gz.

File metadata

  • Download URL: mxm_dataio-0.4.2.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mxm_dataio-0.4.2.tar.gz
Algorithm Hash digest
SHA256 8b76e73359e895b3574fdeb25016c014fe2330cd7c47b538384bbbaf2a69fd39
MD5 7129e6b31b4d0db490bb3f1af54e1dcf
BLAKE2b-256 973f75c34c98219d1b350f51e9d1f230739c1706205e3b6579174670aa62b208

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_dataio-0.4.2.tar.gz:

Publisher: release.yml on moneyexmachina/mxm-dataio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxm_dataio-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: mxm_dataio-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mxm_dataio-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 53107f5d405b3ec76e1c196275ebdefe319d2247dbe074ce52bbc32fc4395608
MD5 2d292d12abdfb608ae297e72662b5934
BLAKE2b-256 1646caae28d4ca918c9b6db2e0105dfd61adba9291781ef52684cfd8c8e15a82

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_dataio-0.4.2-py3-none-any.whl:

Publisher: release.yml on moneyexmachina/mxm-dataio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page