Skip to main content

MCard: Local-first Content Addressable Storage with Content Type Detection

Project description

Python 3.9+ MIT License ruff Build Status

MCard

MCard is a local-first, content-addressable storage platform with cryptographic integrity, temporal ordering, and a Polynomial Type Runtime (PTR) that orchestrates polyglot execution. It gives teams a verifiable data backbone without sacrificing developer ergonomics or observability.


Highlights

  • 🔐 Hash-verifiable storage: SHA-256 hashing, handle registry with history, immutable audit trail output.
  • ♻️ Deterministic execution: PTR mediates 8 polyglot runtimes (Python, JavaScript, Rust, C, WASM, Lean, R, Julia).
  • 📊 Enterprise ready: Structured logging, CI/CD pipeline, security auditing, 99%+ automated test coverage.
  • 🧠 AI-native extensions: GraphRAG engine, optional LLM runtime, and optimized multimodal vision (moondream).
  • 🧰 Developer friendly: Rich Python API, TypeScript SDK, BMAD-driven TDD workflow, numerous examples.
  • 📐 Algorithm Benchmarks: Sine comparison (Taylor vs Chebyshev) across Python, C, and Rust.
  • High Performance: Optimized test suite (~37s) with runtime caching and session-scoped fixtures.

For the long-form narrative and chapter roadmap, see docs/Narrative_Roadmap.md. Architectural philosophy is captured in docs/architecture/Monadic_Duality.md.


Quick Start (Python)

git clone https://github.com/xlp0/MCard_TDD.git
cd MCard_TDD
./activate_venv.sh          # installs uv & dependencies
uv run pytest -q -m "not slow"  # run the fast Python test suite
uv run python -m mcard.ptr.cli run chapters/chapter_01_arithmetic/addition.yaml

Create and retrieve a card:

from mcard import MCard, default_collection

card = MCard("Hello MCard")
hash_value = default_collection.add(card)
retrieved = default_collection.get(hash_value)
print(retrieved.get_content(as_text=True))

Quick Start (JavaScript / WASM)

See mcard-js/README.md for build, testing, and npm publishing instructions for the TypeScript implementation.


Polyglot Runtime Matrix

Runtime Status Notes
Python Reference implementation, CLM runner
JavaScript Node + browser (WASM) + Full RAG Support
Rust High-performance adapter & WASM target
C Low-level runtime integration
WASM Edge and sandbox execution
Lean ⚙️ Formal verification pipeline (experimental)
R Statistical computing runtime
Julia High-performance scientific computing

Project Structure (abridged)

MCard_TDD/
├── mcard/            # Python package (engines, models, PTR)
├── mcard-js/         # TypeScript implementation & npm package
├── chapters/         # CLM specifications (polyglot demos)
├── docs/             # Architecture, PRD, guides, reports
├── scripts/          # Automation & demo scripts
├── tests/            # >450 automated tests
└── requirements.txt / pyproject.toml

Documentation


Testing

# Python Suite
uv run pytest -q                 # Run all tests (~37s)
uv run pytest -q -m "not slow"   # Run fast tests only (~34s)
uv run pytest -m "not network"   # Skip tests requiring LLM/Ollama

# JavaScript Suite
npm --prefix mcard-js test

Contributing

  1. Fork the repository and create a feature branch.
  2. Run the tests (uv run pytest, npm test in mcard-js).
  3. Submit a pull request describing your change and tests.

We follow the BMAD (Red/Green/Refactor) loop – see BMAD_GUIDE.md.


License

This project is licensed under the MIT License – see LICENSE.

For release notes, check CHANGELOG.md.

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

mcard-0.1.25.tar.gz (174.4 kB view details)

Uploaded Source

Built Distribution

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

mcard-0.1.25-py3-none-any.whl (216.1 kB view details)

Uploaded Python 3

File details

Details for the file mcard-0.1.25.tar.gz.

File metadata

  • Download URL: mcard-0.1.25.tar.gz
  • Upload date:
  • Size: 174.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mcard-0.1.25.tar.gz
Algorithm Hash digest
SHA256 9906f04aa7c675771bda58befd23ac681bf238be2a484575eae8a022c7540577
MD5 5982fdf9c84b996fc455696beee73018
BLAKE2b-256 e39a35a860a89efaf6ce34fe09666c5f19c028c296db27775b93b5e80401522f

See more details on using hashes here.

File details

Details for the file mcard-0.1.25-py3-none-any.whl.

File metadata

  • Download URL: mcard-0.1.25-py3-none-any.whl
  • Upload date:
  • Size: 216.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mcard-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 cd6ed376b06aaf1795e4f2f48f4412fbdb674b44b3d2258c011e993905ec5a50
MD5 a19bbdbc764d62cd79cc525541493992
BLAKE2b-256 f200c57570941d8b130b5af252bb3cdd18593fa0d20013f183527823783fe8c4

See more details on using hashes here.

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