Skip to main content

human readable and writable data interchange format

Project description

https://img.shields.io/travis/KenKundert/nestedtext/master.svg https://img.shields.io/coveralls/KenKundert/nestedtext.svg https://img.shields.io/pypi/v/nestedtext.svg https://img.shields.io/pypi/pyversions/nestedtext.svg
Version: 0.2.0
Released: 2020-09-02
Please post all questions, suggestions, and bug reports to NestedText Github.

NestedText is a file format for exchanging data held in strings, lists, and␣ dictionaries. In this way it is similar to JSON, YAML, or StrictYAML, but with a restricted set of supported data types, the file format is simpler. It is␣ designed to be easy to enter with a text editor and easy to read. The small␣ number of data types supported means few rules need be kept in mind when␣ creating a file. The result is a data file that is easily created, modified, or␣ viewed with a text editor and be understood and used by both programmers and␣ non-programmers.

NestedText is convenient for configuration files, address books, account information and the like. Here is an example of a file that contains a few addresses:

# Contact information for our officers

president:
    name: Katheryn McDaniel
    address:
        > 138 Almond Street
        > Topika, Kansas 20697
    phone:
        cell: 1-210-555-5297
        home: 1-210-555-8470
    email: KateMcD@aol.com
    kids:
        - Joanie
        - Terrance

vice president:
    name: Margaret Hodge
    address:
        > 2586 Marigold Lane
        > Topika, Kansas 20682
    phone: 1-470-555-0398
    email: margarett.hodge@uk.edu
    kids:
        - Arnie
        - Zach
        - Maggie

treasurer:
    name: Fumiko Purvis
    address:
        > 3636 Buffalo Ave
        > Topika, Kansas 20692
    phone: 1-268-555-0280
    email: fumiko.purvis@hotmail.com
    kids:
        - Lue

The format can hold dictionaries (ordered collections of name/value pairs), lists (ordered collections of values) and strings organized hierarchically to any depth. Indentation is used to indicate the hierarchy of the data, and a simple natural syntax is used to distinguish the types of data in such a manner that it is not easily confused.

Alternatives

There are no shortage of well established alternative to NestedText for storing data in a human-readable text file. Probably the most obvious are json and YAML. Both have serious short comings.

JSON is a subset of JavaScript suitable for holding data. Like NestedText it consists of a hierarchical collection of dictionaries, lists, and strings, but also allows integers, floats, booleans and nulls. The problem with JSON for this application is that it is awkward. All strings have to be quoted; it only supports multi-line strings by using long single-line strings with embedded newline characters; and dictionary and list items must be separated with commas. All of which results in JSON being a frustrating format for humans to enter or read.

YAML was to be the human friendly alternative to JSON, but things went very wrong at some point. The authors were too ambitious and tried to support too many data types and too many formats. To distinguish between all the various types and formats, a complicated and non-intuitive set of rules developed. YAML at first appears very appealing when used with simple examples, but things quickly become very complicated. A reaction to this is the use of YAML subsets, such as StrictYAML. However, the subsets try to maintain compatibility with YAML and so inherits much of its complexity.

NestedText was inspired by YAML, but eschews its complexity. It supports only a limited number of types and has a very simple set of rules that make up the format.

Quick Start

Install with:

pip3 install --user nestedtext

Issues

Please ask questions or report problems on Github.

Contributing

This package contains a Python implmentation of NestedText. For NestedText to catch on widely, implementations in many language will required. If you like the format and have interest in doing so, please consider contributing additional implementations, particularly for other languages.

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

nestedtext-0.2.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

nestedtext-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file nestedtext-0.2.0.tar.gz.

File metadata

  • Download URL: nestedtext-0.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.7

File hashes

Hashes for nestedtext-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9ce23d14850e93f40df0230c2c48d0441398869ff09e5d7c52648bb12c7ec367
MD5 5cc9a7f037eedd1114d46d9c6139ee2f
BLAKE2b-256 4cad89086b1b0caa9cea0733debb002f49a0239bd1848def80a6acd70766cbed

See more details on using hashes here.

File details

Details for the file nestedtext-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nestedtext-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.7

File hashes

Hashes for nestedtext-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9c19918ba0ab298afc3aec5e31c9428771edccd1a376c6f4264ab561c5a7f7
MD5 c93ae6f2fc8157de0b4875ef366ca3da
BLAKE2b-256 9bb97694c537d3d97c6d810835b81ee8c455daa838e6d538a4dce512653a8cd1

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