Skip to main content

A complete Python library to parse, serialize and deserialize xCDN — eXtensible Cognitive Data Notation

Project description

> xCDN_ (Python)

A complete Python library to parse, serialize and deserialize > xCDN_ — eXtensible Cognitive Data Notation.

What is > xCDN_?
xCDN_ is a human-first, machine-optimized data notation with native types, tags and annotations. It supports comments, trailing commas, unquoted keys and multi‑line strings. You can read more about this notation in the > xCDN_ repository.

Features

  • Full streaming document model (one or more top-level values)
  • Optional prolog ($schema: "...", …)
  • Objects, arrays and scalars
  • Native types: Decimal (d"..."), UUID (u"..."), DateTime (t"..." RFC3339), Duration (r"..." ISO8601), Bytes (b"..." Base64)
  • #tags and @annotations(args?) that decorate any value
  • Comments: // and /* ... */
  • Trailing commas and unquoted keys
  • Pretty or compact serialization

Example

$schema: "https://gslf.github.io/xCDN/schemas/v1/meta.xcdn",

server_config: {
  host: "localhost",
  // Unquoted keys & trailing commas? Yes.
  ports: [8080, 9090,],

  // Native Decimals & ISO8601 Duration
  timeout: r"PT30S",
  max_cost: d"19.99",

  // Semantic Tagging
  admin: #user {
    id: u"550e8400-e29b-41d4-a716-446655440000",
    role: "superuser"
  },

  // Binary data handling
  icon: @mime("image/png") b"iVBORw0KGgoAAAANSUhEUgAAAAUA...",
}

Usage

from xcdn import parse_str, ser

doc = parse_str(open("sample.xcdn").read())
text = ser.to_string_pretty(doc)
print(text)

Installation

pip install .

Or for development:

pip install -e .

Testing

pytest

License

MIT, see LICENSE.


This is a :/# GSLF 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

xcdn-0.1.5.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

xcdn-0.1.5-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file xcdn-0.1.5.tar.gz.

File metadata

  • Download URL: xcdn-0.1.5.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xcdn-0.1.5.tar.gz
Algorithm Hash digest
SHA256 13cb688c111492cedbce2f3e4e0b775b88b6b4b147bb4b7c2991a1061be51b3c
MD5 b612f35d5a7538afb4cf7483bcc8a2d9
BLAKE2b-256 76b1a2545c69741417ee464c627b405d3326718ea0f394973f5dcc69999ef9f1

See more details on using hashes here.

File details

Details for the file xcdn-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: xcdn-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for xcdn-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b8666148801ac1bf70bf9c0f1113d763e6c3dafd213f3073b14923b8e9dac471
MD5 7051574e296410d409845d8315c9b83c
BLAKE2b-256 2a0368d48b5d10b77103fb86d10384d81c813d6106a8a679a3a7561f54fe7edb

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