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.

Install from PyPI with:

pip install crude-engine

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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crude_engine-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 51fee16190e2efebec24f156ac3c7311e6311b84f6b6a917ac1b887d98230789
MD5 83b0dbb0b96ce5f73a27a9d7d3a161c0
BLAKE2b-256 deb3d79055c1efe7b0c070482caed3bae3e34fd2a928c256c2c3e8df74811a19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: crude_engine-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 feb0b59b2bc6996dbbd29bfa443ffcbb7632ef9afe787185be949bbdbc890ff6
MD5 cef693dba5e95d48ca13ab5a89b6555d
BLAKE2b-256 932aa218cc6e0e52d94486073f8e513a8024e2718557710469f9d50531ccc2a4

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