Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.2.4 instead.

MooFile

MooFile

A lightweight, embedded, single-file document store with a developer-friendly query API.
No server. No infrastructure. Just a file and a library.
🦀 Rust core available — 2-24× faster than pure Python.

from moofile import Collection, count, mean

with Collection("mydata.bson", 
                indexes=["email", "age"],
                vector_indexes={"embedding": 384},
                text_indexes=["content"]) as db:
    
    db.insert({
        "name": "Alice", 
        "email": "alice@example.com", 
        "age": 30,
        "content": "Machine learning and data science expert",
        "embedding": [0.1, 0.2, ...]
    })

    # Traditional query
    results = db.find({"age": {"$gt": 25}}).sort("age").to_list()
    
    # Vector similarity search
    similar = db.find({}).vector_search("embedding", query_vector, limit=5).to_list()
    
    # BM25 text search
    text = db.find({}).text_search("content", "machine learning", limit=10).to_list()

Why MooFile?

SQLite JSON file MongoDB MooFile
No server
Document-oriented
Indexes
Vector search ✓ (Atlas)
Text search ✓ (FTS)
Developer API ✗ (SQL) ✓ (raw)
Single-file portable
Rust core available ✓ (v0.3+)

Target dataset size: megabytes to single-digit gigabytes.


Installation

pip install moofile

This installs the pure-Python version which works everywhere. See Native install below for the Rust-powered version.


Quick Start

from moofile import Collection

db = Collection("users.bson", 
                indexes=["email", "status"],
                text_indexes=["bio"],
                vector_indexes={"profile_vec": 128})

# Insert
alice = db.insert({"name": "Alice", "email": "a@ex.com", "age": 30, "status": "active"})
db.insert_many([...])

# Query
active = db.find({"status": "active"}).to_list()
young  = db.find({"age": {"$lt": 30}}).sort("age").to_list()
one    = db.find_one({"email": "alice@example.com"})

# Vector search
similar = db.find({}).vector_search("profile_vec", query_vector, limit=3).to_list()
for doc, score in similar:
    print(f"{doc['name']}: {score:.3f}")

# Text search
results = db.find({}).text_search("bio", "machine learning", limit=5).to_list()

# Update & Delete
db.update_one({"email": "a@ex.com"}, set={"age": 31})
db.update_many({"status": "trial"}, set={"status": "expired"})
db.delete_one({"email": "c@ex.com"})
db.delete_many({"status": "expired"})

Native Install (Rust Core)

When the Rust native extension is installed, import moofile transparently uses it — same API, 2-24× faster.

From source (requires Rust)

# Install Rust: https://rustup.rs
curl --proto '=https' --tls v1.2 -sSf https://sh.rustup.rs | sh

# Build and install with native extension
pip install maturin
cd moofile
maturin develop --release

Prebuilt wheels

Coming soon — GitHub Actions CI will build platform wheels for:

Platform Architectures
Linux x86_64 (manylinux)
macOS x86_64, ARM64 (Apple Silicon)
Windows x86_64

In the meantime, pip install moofile always works (pure Python fallback).


CLI Tools

Tool Description
moosh Interactive Python shell with db pre-bound
moo2json Export/import to/from JSON
moo2mongo Export/import to/from MongoDB
moo2sqlite Export/import to/from SQLite
moosh users.bson --indexes email,age
moo2json users.bson users.json
moo2json --import users.json users.bson --indexes email
moo2mongo users.bson --uri mongodb://localhost/mydb --collection users
moo2sqlite users.bson users.db --table people

Full Documentation


Development

# Pure-Python tests (always run)
pytest tests/ -v

# Cross-implementation tests
pytest tests-cross/ -v

# Rust core tests
cd core && cargo test

# Rust benchmark
cd core && cargo run --example bench --release

# Python vs Rust benchmark
PYTHONPATH=. python bench_native.py

Project layout

moofile/
├── core/                    # Rust engine (cargo build)
│   ├── src/{lib,storage,index,query,text,cache,errors}.rs
│   └── examples/bench.rs    # Pure-Rust benchmark
├── bindings/python/         # PyO3 binding (maturin build)
│   └── src/lib.rs
├── moofile/                 # Python package
│   ├── __init__.py          # Auto-detects Rust, falls back to Python
│   ├── _rust_adapter.py     # Adapts NativeCollection → Collection API
│   ├── collection.py        # Pure-Python reference implementation
│   ├── query.py, index.py, storage.py, ...
│   └── cli/                 # moosh, moo2json, moo2mongo, moo2sqlite
├── tests/                   # Python test suite
├── tests-cross/             # Cross-implementation validation
└── pyproject.toml

License

MIT — see LICENSE.

Release files for moofile 0.4.1

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

Built distributions (wheels)

Table of built distributions (wheels) for moofile 0.4.1
File
moofile-0.4.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
moofile-0.4.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
moofile-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
moofile-0.4.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
moofile-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details

Total release size: 5.3 MB

Release files / moofile-0.4.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL moofile-0.4.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a6309a29288c72f9300b15712cc2bd5060c0b05726dde561ac3b79794a305ce3
BLAKE2b-256 checksum
How to use checksums
a7813289fdf5335ba00d7f85ed822318b77971e446ab810064eacaaff442cde7
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 Jul 13, 2026.

Transparency log

Release files / moofile-0.4.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL moofile-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
Size 983.1 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9a4604738ea88c4208f05a3bfedb7fe0a8a98e874e7e95f58e11a98e4ef4cb06
BLAKE2b-256 checksum
How to use checksums
033254a31e5dd6be4b41d606bf697eeaff98170c41ab30966569763626e8abb6
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 Jul 13, 2026.

Transparency log

Release files / moofile-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL moofile-0.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
96bf4fa75d3652fe9d9d06c14b1436b72fae806b132ab38ee7a339945ff76bba
BLAKE2b-256 checksum
How to use checksums
73828c41da5d6c72013609ea0681b7c4d634bf4376f4600aee2deb6eaed6c2b5
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 Jul 13, 2026.

Transparency log

Release files / moofile-0.4.1-cp312-cp312-win_amd64.whl

Download URL moofile-0.4.1-cp312-cp312-win_amd64.whl
Size 912.7 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
9515e670b1beabbf2fcb80d7a9b7ffd511e62a2dbb5cf0cac9207a500df11360
BLAKE2b-256 checksum
How to use checksums
15c850621a45f621430952864c995205b145e07729278be756fea73adaf312bf
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 Jul 13, 2026.

Transparency log

Release files / moofile-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL moofile-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6dc3229834810e54f8441a50e9b690a82ad2e6f014c4f3b9876b27532dedef89
BLAKE2b-256 checksum
How to use checksums
97da5e1bc23393eb08262b3eb03d39a29e3d06ed02d1aa7cd3eb79febcc3a5a4
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 Jul 13, 2026.

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