Skip to main content

JSON-backed CRUD helper with schema validation and execution engine

Project description

CRUDE

CRUDE is a lightweight JSON-backed CRUD helper for small Python projects.

It gives you:

  • JSON file loading and saving
  • dot-path key access like profile.name
  • optional schema validation
  • simple task execution through a safe action registry

Quick Start

from crude import Crude

store = Crude("data.json", "data_schema.json")

print(store.read())
print(store.get("name"))

store.update("age", 21)
store.save()

Demo

Run the demo script:

python examples/demo.py

The demo uses temporary copies of data.json and data_schema.json, so the checked-in sample data is not modified.

Tests

Run the unit tests (built-in unittest):

python -m unittest

Schema Format

Primitive types use string names:

{
    "name": "str",
    "age": "int"
}

Nested objects use nested dictionaries:

{
    "profile": {
        "name": "str",
        "active": "bool"
    }
}

Lists can use one schema item as a template for all entries, or multiple items for index-based validation.

Notes

  • read() reloads from disk.
  • read_cache() reads the in-memory state.
  • update(key, value) updates the cache and saves to disk.
  • save() explicitly writes the current cache to disk.
  • reload() reloads the cache from disk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crude_engine-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crude_engine-0.1.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file crude_engine-0.1.0.tar.gz.

File metadata

  • Download URL: crude_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for crude_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b168eceb71480db5bcb47d6481fcc1988cc421f3df8799d154cdb6aa77a4cfc5
MD5 08e65622adab7de6ff4eb7db42abe180
BLAKE2b-256 2243ccec6174448c1814c68d51a2531cf9a651b9e03c681550d8cfdc38f274d6

See more details on using hashes here.

File details

Details for the file crude_engine-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crude_engine-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for crude_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38d47a3701d1d6c2b3d757104470ed475b0737bca12af06643f3a96c746e402e
MD5 b363359a0e96c6f11485d5bd424486a4
BLAKE2b-256 fec1560f298a5133d84f072cc8b40969760dcd1e68742a6467c6ec80b0aff171

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page