Skip to main content

pymingledb

Lightweight file-based NoSQL engine — Python port of mingleDB. Same format as the JavaScript and gomingleDB implementations: BSON serialization, zlib compression, optional schema validation, query operators, and basic authentication.

Install (uv)

cd pymingledb
uv sync

Or add to your project:

uv add pymingledb

Usage

from pymingledb import MingleDB, ValidationError, UsernameExistsError, AuthFailedError

db = MingleDB("./mydb")  # directory -> ./mydb/database.mgdb
# db = MingleDB("./mydb/app.mgdb")  # explicit single-file path

# Schema (optional)
db.define_schema("users", {
    "name": {"type": "string", "required": True},
    "email": {"type": "string", "required": True, "unique": True},
    "age": {"type": "number"},
})

# CRUD
db.insert_one("users", {"name": "Alice", "email": "alice@example.com", "age": 30})
db.insert_one("users", {"name": "Bob", "email": "bob@example.com", "age": 17})

db.find_all("users")
db.find_one("users", {"email": "alice@example.com"})
db.find("users", {"age": {"$gte": 18, "$lt": 60}})
db.find("users", {"name": {"$regex": "ali", "$options": "i"}})
db.find("users", {"email": {"$in": ["alice@example.com", "bob@example.com"]}})

db.update_one("users", {"name": "Alice"}, {"age": 31})
db.delete_one("users", {"email": "bob@example.com"})

# Auth (uses internal _auth collection)
db.register_user("admin", "secure123")
db.login("admin", "secure123")
db.is_authenticated("admin")  # True
db.logout("admin")

# Reset (wipe database file and schemas)
db.reset()

Query operators

  • $gt, $gte, $lt, $lte — numeric comparison
  • $eq, $ne — equality
  • $in, $nin — in list / not in list
  • $regex, $options — regex (e.g. "i" for case-insensitive)

You can also pass a compiled re.Pattern as a filter value for regex match.

Exceptions

  • MingleDBError — base
  • UsernameExistsError — register with existing username
  • AuthFailedError — login failed
  • ValidationError — schema validation (required, type, unique)

File format

All collections are stored in one .mgdb database file, compatible with mingleDB (JS) and gomingleDB (Go). Internal file layout details are intentionally abstracted from user-facing docs.

Tests

uv sync --extra dev
uv run pytest tests/ -v

License

Use under the same terms as mingleDB / gomingleDB.

Metadata

Release files for pymingledb 1.1.0

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

Source distribution (sdist)

Source distribution for pymingledb 1.1.0
File Size Uploaded
pymingledb-1.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymingledb 1.1.0
File Interpreter ABI Platform
pymingledb-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / pymingledb-1.1.0.tar.gz

Download URL pymingledb-1.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1eefb87ebfc51637a3ef64ada439b4120bad26ea9fa3b5703743bde44264edb4
BLAKE2b-256 checksum
How to use checksums
b2b4cba0619f2091294d52fc071dd6b42224235690026268bf25d908dc7b478f
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 Apr 14, 2026.

Transparency log

Release files / pymingledb-1.1.0-py3-none-any.whl

Download URL pymingledb-1.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c540fb4a3bdf6e4fe7d9eb8a7dd3bf9fbfdbc6711b277c278dbef317a5affb2
BLAKE2b-256 checksum
How to use checksums
fe8f5eaf8e8a42cfa7502abe0cf216b88a9bb2123253753e7b1e87c0c408f7f1
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 Apr 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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