Skip to main content

LinkedIn Portal ORCID License

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

  • Enterprise Forensic Automation: Ghost table (_forensic_audit_log) audit trail for all document mutations (INSERT, UPDATE, DELETE).
  • Multi-Table Manager & Registry: Multi-model registration with dictionary indexing app[User] and dynamic attribute dispatch app.user.
  • 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, and deleted_at.
  • Thread Safety: Integrated reentrant locks for safe multi-threaded access.
  • CLI Utility: Command-line tool wtinydb to 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.


👤 Autor & Afiliación Oficial

Metadata

Release files for wtinydb 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 wtinydb 1.1.0
File Size Uploaded Provenance
wtinydb-1.1.0.tar.gz 18.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 32.5 kB

Release files / wtinydb-1.1.0.tar.gz

Download URL wtinydb-1.1.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b95dc09dcb0fd8ffab5913ce1f49ebebef521b21f02e7bbe6c9db5cdf7dccf7b
BLAKE2b-256 checksum
How to use checksums
21055a25f6cbb7bf84ebe931759beb984bc6ec5499610924ab75d293a4ccce4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL wtinydb-1.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bc78af16ef22a23f6764d6fd99c1b237ee504e432d45c021e778b5b30bc76e4
BLAKE2b-256 checksum
How to use checksums
b0a4ac782d403c288e029e3e8389a269e4f5c1159467ae038a09da3586eb127b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for wtinydb 1.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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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