Skip to main content

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 safely
  • write(path, value) — Write nested values
  • delete(path) — Remove keys or list elements
  • exists(path) — Check if path exists
  • merge(other) — Merge dictionaries
  • append(path, value) — Append to lists
  • remove_from_list(path, value) — Remove items from lists
  • dump() / dumps() — Return deep copy or serialize NDCA data
  • load(filename) / load_from_text(text) — Load NDCA data from file or string
  • save(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 table
  • table_insert(path, row) — Insert a row
  • table_get_row(path, index) — Retrieve a specific row
  • table_find(path, criteria) — Query rows by dict or callable
  • table_update_row(path, index, updates) — Update specific row fields
  • table_delete_row(path, index) — Remove a row
  • table_index(path, key, unique=False) — Index rows by key
  • table_sort(path, key, reverse=False) — Sort rows
  • table_to_csv(path, filename, include_header=True) — Export to CSV
  • table_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


Download files

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

Source Distribution

ndca-3.0.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

ndca-3.0.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

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

Hashes for ndca-3.0.0.tar.gz
Algorithm Hash digest
SHA256 0cdc84a2434d89a2fb9aa71c9a6246c7635cd0a3877fe928a538cfbfe5d2205c
MD5 fb675c364d66d62d19d514b1cc624a6b
BLAKE2b-256 161ff296417b1450ee8bfea28f241666bceb9f203301e77bc9f95b80421b7105

See more details on using hashes here.

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

Hashes for ndca-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57ff1a1421846d2959edf7541c5cad7f01807c7e2e80b4de5d132fc30c52d191
MD5 e42f3f4072644884b423c9d3f6854b41
BLAKE2b-256 b3e3a3490817c3a970631807836dfd082fe44c83ac7645d8aef5cd21c222beda

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