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.24.tar.gz (173.7 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.24-py3-none-any.whl (214.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcard-0.1.24.tar.gz
  • Upload date:
  • Size: 173.7 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.24.tar.gz
Algorithm Hash digest
SHA256 445b14d61d7c7b20323208a97ca72b86c477bcb99222274d93da50a2389f567e
MD5 074f8614efb20783dd43914af055ca10
BLAKE2b-256 97613887768d38615e9a3ca132dfe05adac299aa450762a5e36b214212c56f7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcard-0.1.24-py3-none-any.whl
  • Upload date:
  • Size: 214.2 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.24-py3-none-any.whl
Algorithm Hash digest
SHA256 90527637a3619037ec58e4f2e96dc57514b6729a855216d60218c7f1abfbc748
MD5 2b88a5249f4f5ab1ab96ddf6b6a781dc
BLAKE2b-256 7dac4eb3178dc12dfe4b2c730e1e4291de640ce6fbd813a3ed55979a05da4b74

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