Skip to main content

nrdl

A pure-Python implementation of NRDL, the Nestable, Readable Document Language — a superset of JSON with comments, multi-line strings, and symbols. This package is a port of the reference implementation in Common Lisp, following the language specification and ABNF in the repository README.

Installation

pip install nrdl

Usage

The API follows the json module's conventions: load/dump work with file handles, and loads/dumps work with strings.

import nrdl

# Deserialize an NRDL document from a string.
doc = nrdl.loads("""
{
    the-wind "bullseye"
    the-trees false
    the-sparrows his-eye
}
""")
# -> {"the-wind": "bullseye", "the-trees": false, "the-sparrows": "his-eye"}

# Or from a file handle.
with open("config.nrdl", encoding="utf-8") as fh:
    doc = nrdl.load(fh)

# Serialize Python data back to NRDL.
nrdl.dumps(doc, pretty_indent=4)
# -> '{\n    the-sparrows "his-eye"\n    the-trees false\n    the-wind "bullseye"\n}'

# Write it to a file handle.
with open("config.out.nrdl", "w", encoding="utf-8") as fh:
    nrdl.dump(doc, fh, pretty_indent=4)

# Emit a JSON document instead.
nrdl.dumps(doc, json_mode=True)
# -> '{"the-sparrows": "his-eye", "the-trees": false, "the-wind": "bullseye"}'

Because Python has no symbol type, NRDL symbols deserialize to plain strings, and true/false/null deserialize to True/False/None. When serializing, dictionary keys are written as symbols while string values are written as quoted strings.

Command line

The package also installs an nrdl command that parses documents and prints the parsed data, as NRDL by default or as JSON with --json:

$ nrdl config.nrdl
{
    the-wind "bullseye"
}
$ nrdl --json config.nrdl
{
    "the-wind": "bullseye"
}
$ cat config.nrdl | nrdl
...
$ nrdl --validate config.nrdl && echo ok
ok

nrdl --validate parses documents without printing them, reporting only problems to stderr and exiting non-zero when a document is invalid.

Full documentation is available on ReadTheDocs.

Metadata

Release files for nrdl 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nrdl 0.2.0
File Size Uploaded
nrdl-0.2.0.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nrdl 0.2.0
File Interpreter ABI Platform
nrdl-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / nrdl-0.2.0.tar.gz

Download URL nrdl-0.2.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e3f41b8ad91133bd17c449777275c5c639a333f6973ddcb2f1960fe2139d41cb
BLAKE2b-256 checksum
How to use checksums
9474b7e8c67bc89d44a5fec20c0a08e73a2148d2e74b9ce2228aa62ba9727bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / nrdl-0.2.0-py3-none-any.whl

Download URL nrdl-0.2.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2251369136ca11f4130ec7cda3fff57ed9afd73bf762584b7461b4846ee470d1
BLAKE2b-256 checksum
How to use checksums
0207aff67c3fd222cbe1b311b14cc938702e76f3678d874da29b4a7e4706e496
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page