NDCA (Nested Data Collection API) — a fast, safe, and human-readable nested data storage and manipulation library for Python.
Project description
NDCA — Nested Data Collection API (v3.0.0)
NDCA (Nested Data Collection API) is a fast, secure, and production-ready Python library for storing, reading, and manipulating nested structured data using a compact human-readable format. NDCA is designed for robustness, atomic persistence, safe in-memory operations, and an ergonomic API suitable for scripts, services, and small-to-medium projects.
Highlights
- Human-readable NDCA format for nested objects and lists
- Deep-copy safety on reads/writes to avoid accidental mutation
- Atomic file writes to protect data integrity on crashes or interruptions
- Optional autosave per-file instance (
file("x.ndca", autosave=True)) - Path-based get/write/delete API supporting nested keys and list indices
- Merge, append, remove-from-list, dump/load-from-text, and table operations
- Table utilities: create, insert, find, update, delete, sort, CSV import/export
- Pagination support for lists and tables
- Version
3.0.0— stable initial feature set
Installation
Install via pip:
pip install ndca
Or include locally by copying the NDCA module into your project.
NDCA File Format
NDCA uses a human-readable format to represent nested objects and lists:
Objects
<[key]="value";[key2]=123;[key3]=true;>
Lists
(value1;value2;value3;)
Nested Structures
<[name]="Viren";[age]=12;[skills]=("Python";"Bash";"NDCA");[settings]=<[theme]="dark";[enabled]=true;>;>
Rules
- Objects start with
<and end with> - Keys are wrapped in square brackets
[key] - Key/value pairs are separated with
= - Each item ends with
; - Lists are wrapped in
( ) - Strings use double quotes
" " - Booleans (
true/false) and null (null) are supported - Supports nested objects and lists
Basic Usage
from ndca import NDCA
store = NDCA()
store.write("user", '<[name]="Viren";[age]=12;>')
store.write("config", '<[enabled]=true;[theme]="dark";>')
print(store.get("user"))
# Output: '<[name]="Viren";[age]=12;>'
Core Features
get(path, default)— Read nested values safelywrite(path, value)— Write nested valuesdelete(path)— Remove keys or list elementsexists(path)— Check if path existsmerge(other)— Merge dictionariesappend(path, value)— Append to listsremove_from_list(path, value)— Remove items from listsdump()/dumps()— Return deep copy or serialize NDCA dataload(filename)/load_from_text(text)— Load NDCA data from file or stringsave(filename)/hash_write(filename)— Save with atomic write and optional hash
Table Utilities
NDCA supports lightweight table structures with rows and columns:
table_create(path, columns)— Create a new tabletable_insert(path, row)— Insert a rowtable_get_row(path, index)— Retrieve a specific rowtable_find(path, criteria)— Query rows by dict or callabletable_update_row(path, index, updates)— Update specific row fieldstable_delete_row(path, index)— Remove a rowtable_index(path, key, unique=False)— Index rows by keytable_sort(path, key, reverse=False)— Sort rowstable_to_csv(path, filename, include_header=True)— Export to CSVtable_from_csv(path, filename, columns=None)— Import from CSV
Pagination Support
page_data = store.paginate("mylist", page=1, per_page=10)
print(page_data["items"])
Returns a dictionary with page, per_page, total, and items.
Version
NDCA Version: 3.0.0
Example NDCA Data
<[user]=<[name]="Viren";[age]=12;>;[settings]=<[theme]="dark";[notifications]=true;>;[skills]=("Python";"Bash";"NDCA");>
License
Read the license under this project!
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 ndca-3.0.0.tar.gz.
File metadata
- Download URL: ndca-3.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cdc84a2434d89a2fb9aa71c9a6246c7635cd0a3877fe928a538cfbfe5d2205c
|
|
| MD5 |
fb675c364d66d62d19d514b1cc624a6b
|
|
| BLAKE2b-256 |
161ff296417b1450ee8bfea28f241666bceb9f203301e77bc9f95b80421b7105
|
File details
Details for the file ndca-3.0.0-py3-none-any.whl.
File metadata
- Download URL: ndca-3.0.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ff1a1421846d2959edf7541c5cad7f01807c7e2e80b4de5d132fc30c52d191
|
|
| MD5 |
e42f3f4072644884b423c9d3f6854b41
|
|
| BLAKE2b-256 |
b3e3a3490817c3a970631807836dfd082fe44c83ac7645d8aef5cd21c222beda
|