Skip to main content

ZPL: ZeroMQ Property Language

Project description

The ZeroMQ Property Language (ZPL) defines a minimalistic framing language for specifying property sets, expressed as a hierarchy of name-value property pairs.

See the original specification here: https://rfc.zeromq.org/spec:4/ZPL/

Goals

ZPL is designed to represent a property set, where each property has a name and a value. Properties are hierarchical, i.e. properties can contain other properties. It aims to:

  • Be easy to read and edit, using visual clues for semantics.

  • Be minimalistic in terms of syntax.

  • Be trivial to parse in any programming language.

  • Be usable as a continuous stream of name/value updates.

  • Be able to represent hierarchical data structures.

  • Be neutral with respect to data typing.

  • Reduce the risk of human error to as close to zero as possible.

The use cases for ZPL include:

  • Configuration files edited by hand where readability is key.

  • Streamed data exchange.

  • Streamed logging.

Specification

ZPL is an ASCII text format that uses whitespace - line endings and indentation - for framing and hierarchy. ZPL data consists of a series of properties encoded as name/value pairs, one per line, where the name may be structured, and where the value is an untyped string.

Implementations should treat any of the following sequences as a line-ending: newline (%x0A), carriage-return (%x0D), or carriage-return followed by newline (%x0A %x0D).

Here is a typical example of a ZPL file:

1. ZPL configuration file example
1. This format is designed to be trivial to write and parse
#
context
    iothreads = 1
    verbose = 1      #   Ask for a trace

main
    type = zmq_queue
    frontend
        option
            hwm = 1000
            swap = 25000000
            subscribe = "#2"
        bind = tcp://eth0:5555
    backend
        bind = tcp://eth0:5556

Notes:

  • Whitespace is significant only before property names and inside values.

  • Text starting with ‘#’ is discarded as a comment.

  • Each non-empty line defines a property consisting of a name and an optional value.

  • Values are untyped strings which the application may interpret in any way it wishes.

  • An entire value can be enclosed with single or double quotes, which do not form part of the value.

  • Any printable character except the closing quote is valid in a quoted string.

  • A value that starts with a quote and does not end in a matching quote is treated as unquoted.

  • There is no mechanism for escaping quotes or other characters in a quoted string.

  • The only special characters in ZPL are: whitespace, ‘#’, ‘=’, and single and double quotes.

  • Hierarchy is signaled by indentation, where a child is indented 4 spaces more than its parent.

  • The first non-whitespace character in a ZPL file is always either ‘#’ or an alphanumeric character.

  • Whitespace following after a value is discarded unless within valid quotes.

Names SHALL match this grammar:

name = *name-char
name-char = ALPHA | DIGIT | "$" | "-" | "_" | "@" | "." | "&" | "+" | "/"

Justification and Design

ZPL exists because alternatives were inadequate:

  • XML cannot be read or written as a stream.

  • JSON cannot be read or written as a stream and is clumsy to edit due to delimiters between item lists.

  • YAML is relatively complex to parse.

  • UNIX-style configuration syntax does not support name hierarchies.

The use of significant whitespace may be controversial. It is meant to be easier to create and verify manually than syntax elements such as braces. It eliminates the need for separators. The fixed 4-character indentation is meant to avoid confusion and errors when fragments of ZPL files from different sources are mixed together.

The lack of type awareness and other semantic validation is deliberate. ZPL is not meant to be a formal grammar but a simple-to-parse framing for name/value pairs. It emulates 0MQ insofar as it frames data but does not attempt to inspect or validate that data.

Backlog

  • Implement Serialization of Streams

  • Add travis CI

  • Implement Cython based Parsing/Serialization

Changelog

todo (add based on git commit message parsing)

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

pyzpl-0.1.9.tar.gz (5.6 kB view details)

Uploaded Source

Built Distributions

pyzpl-0.1.9-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

pyzpl-0.1.9-py2-none-any.whl (8.7 kB view details)

Uploaded Python 2

File details

Details for the file pyzpl-0.1.9.tar.gz.

File metadata

  • Download URL: pyzpl-0.1.9.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyzpl-0.1.9.tar.gz
Algorithm Hash digest
SHA256 441dd8ae7441590588fa5ccde60860e18dc22ab47a7d36aee23f5352ed8691ba
MD5 eaed7ee4f4a30ff0b26902a6ff415936
BLAKE2b-256 addeaa4e2a2ab9e2eb8d876c0d99d294716a10b2dee76d608565b29db268c9e2

See more details on using hashes here.

File details

Details for the file pyzpl-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for pyzpl-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ef9583b6443d9fe2948352b88bf1b149c243777ae7b3b4c611dbc477b0c5e9ac
MD5 41f0e7363ec8213d482528f6808fc6d4
BLAKE2b-256 1414e06c9a104f682696f3983021b43e11971be4e7546528f2f98bd2bc61f22c

See more details on using hashes here.

File details

Details for the file pyzpl-0.1.9-py2-none-any.whl.

File metadata

File hashes

Hashes for pyzpl-0.1.9-py2-none-any.whl
Algorithm Hash digest
SHA256 2920dd91fa3a747a585339ab8f9ddcb135b6bb2ee9a92d144c7bdeb991052c7c
MD5 7924130de710f25f38a2adedab2d47b0
BLAKE2b-256 52bfe99f0063c5b5d041edea7f2813927635bba38f9c7f8b9ad4e185b1927424

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page