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.3.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.3-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mxm_dataio-0.4.3.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.3.tar.gz
Algorithm Hash digest
SHA256 61846b9ba3d73191ad5cfb5ef6313d877102b85e54fe3b1ca3dba91b31552e44
MD5 ff3ecee2b3be9c194165a74542704986
BLAKE2b-256 83ea33fe296091614c8a38ed762e4dc55b4dc9cb420daa29a6db307d7ed6052a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_dataio-0.4.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: mxm_dataio-0.4.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5ab8f01433baa813e53cbb2caa570ca4a86ec99c3ba5ce0456eb517f18d021d6
MD5 13e08c73320753965ac915bd52d5cccb
BLAKE2b-256 7b09e3a0407e2bde51abc6ca9ef61c14eda23cb967736e9fba3c793605acd679

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxm_dataio-0.4.3-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