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.0.tar.gz (15.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.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xcdn-0.1.0.tar.gz
  • Upload date:
  • Size: 15.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.0.tar.gz
Algorithm Hash digest
SHA256 625cb0b77d9707d15b538081ad9a4feee2e76a07c6324fcbfdfd0de286a1e617
MD5 fc5b6e44161837940ae3385e15fd3fa0
BLAKE2b-256 e4714f494b18de6ee8c818bc8d6b8dfd27a0d401dc0bd9691ea57ef6d1403f54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xcdn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 376b31bebd22444160a390209cfd016762ec41e51892bff97aedef634175ede2
MD5 a2c620b42950a9783fa47f9e27e30d82
BLAKE2b-256 eb71d01e1cbbb9e8834748e14385cbdf571d1ead97b85e25453c25eedb2edee8

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