Lightweight file-based NoSQL engine (Python port of mingleDB). BSON + zlib, schema, query operators, auth.
Project description
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") # or any 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 all collections 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— baseUsernameExistsError— register with existing usernameAuthFailedError— login failedValidationError— schema validation (required, type, unique)
File format
Collections are stored as <collection>.mgdb files: header MINGLEDBv1, 4-byte meta length, JSON meta, then for each document: 4-byte length + zlib(BSON(doc)). Compatible with mingleDB (JS) and gomingleDB (Go).
Tests
uv sync --extra dev
uv run pytest tests/ -v
License
Use under the same terms as mingleDB / gomingleDB.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymingledb-1.0.1.tar.gz.
File metadata
- Download URL: pymingledb-1.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
995ef387294eafeab4e14b13ed2bc3e1f5c0df10745f856013b1c9731c1eb00c
|
|
| MD5 |
90ce94a22255c8dcdc315152fd065a05
|
|
| BLAKE2b-256 |
3528eec34fa5d478e6cfe0b8e1ad5d75bd814fe6974be4ff04939f729980c549
|
Provenance
The following attestation bundles were made for pymingledb-1.0.1.tar.gz:
Publisher:
publish-pypi.yml on mingledb/pymingleDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymingledb-1.0.1.tar.gz -
Subject digest:
995ef387294eafeab4e14b13ed2bc3e1f5c0df10745f856013b1c9731c1eb00c - Sigstore transparency entry: 1246290849
- Sigstore integration time:
-
Permalink:
mingledb/pymingleDB@30ff50305e33657da83d0e860ce60442e9017914 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/mingledb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@30ff50305e33657da83d0e860ce60442e9017914 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pymingledb-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pymingledb-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a2a745b97a9ab93648f701737b778fd3d7e0d3640e540a0a5011e7a3d1b82bf
|
|
| MD5 |
37fe2ee713644fe75343cced5ed0a04a
|
|
| BLAKE2b-256 |
a1e32124c68472feacf8e4492698d639bd0f559e0d27efc4b714ac2c346a6ac3
|
Provenance
The following attestation bundles were made for pymingledb-1.0.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on mingledb/pymingleDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymingledb-1.0.1-py3-none-any.whl -
Subject digest:
9a2a745b97a9ab93648f701737b778fd3d7e0d3640e540a0a5011e7a3d1b82bf - Sigstore transparency entry: 1246290879
- Sigstore integration time:
-
Permalink:
mingledb/pymingleDB@30ff50305e33657da83d0e860ce60442e9017914 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/mingledb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@30ff50305e33657da83d0e860ce60442e9017914 -
Trigger Event:
push
-
Statement type: