WTinyDB: Lightweight Pydantic Document Database Engine
wtinydb is a high-level, document-oriented NoSQL database abstraction built on top of TinyDB and Pydantic. It provides schema-validated CRUD operations, fluent query builders, async support, audit mixins, and command-line management for embedded Python applications.
Key Technologies & Libraries
- TinyDB: Pure Python document-oriented database storing records as JSON.
- Pydantic v2: Data validation, settings management, and JSON-schema document serialization.
- Pytest: Modern Python testing framework.
- Pytest-Cov: Code coverage measurement for pytest.
- Docker: Containerization for reproducible testing environments.
Features
- Pydantic Model Mapping: Automatic serialization, deserialization, and schema validation.
- Fluent Query Builder (
Q): Intuitive query building with comparison operators, regex matching, and text search. - Async Support (
AsyncWTinyDB): Non-blocking thread-pool execution for FastAPI and Starlette apps. - Soft Delete & Audit Mixins: Built-in support for
created_at,updated_at,is_deleted, anddeleted_at. - Thread Safety: Integrated reentrant locks for safe multi-threaded access.
- CLI Utility: Command-line tool
wtinydbto inspect, count, and export JSON tables.
Quickstart Example
from pydantic import BaseModel, Field
from wtinydb import WTinyDB, Q, SoftDeleteMixin
# Define document schema
class User(SoftDeleteMixin, BaseModel):
name: str
email: str = Field(description="User email")
age: int = 18
# Initialize WTinyDB repository (in-memory or file-backed)
db = WTinyDB(User, in_memory=True)
# 1. Insert
user = db.insert(User(name="Alice", email="alice@example.com", age=30))
# 2. Query
results = db.find(Q("age").gte("age", 25))
# 3. Soft Delete & Restore
db.delete(1, hard=False)
Running Unit Tests & Coverage
Local Pytest Execution
# Run pytest test suite
pytest tests/
# Calculate code coverage
./scripts/run_coverage.sh
Docker Containerized Test Execution
All unit tests can be executed inside an isolated Docker container:
./scripts/run_tests_docker.sh
Part of the wisrovi SUITE ecosystem.
Metadata
Release files for wtinydb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wtinydb-0.1.0.tar.gz | 14.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wtinydb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.5 kB
Release files / wtinydb-0.1.0.tar.gz
| Download URL | wtinydb-0.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2963ab05acf4c453ca1f7fdf22e7fad2b9c9d458c6c3696aaae3851ce198f1d
|
|
BLAKE2b-256 checksum How to use checksums |
b45ccafc2b0767ce1fcdc2c23d6c9cf006b0660664a05214115906aad05c62b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / wtinydb-0.1.0-py3-none-any.whl
| Download URL | wtinydb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb9ff99e99a2f114ec671d1ede60e7de899f43dd10d7aa6f5d1b1baad5d7f662
|
|
BLAKE2b-256 checksum How to use checksums |
8244a47aba0f390e9a6617cd3c8a2497ec98cddb59c87052863c65fd4be4b6e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for wtinydb 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.