Skip to main content

jmd-format — Python Reference Implementation

Python reference implementation of the JMD specification (v0.3.5). Includes a C-accelerated parser and serializer, plus lossless XML↔JMD conversion.

Installation

Install the latest version directly from GitHub:

pip install git+https://github.com/ostermeyer/jmd-impl.git

Or pin a specific release:

pip install git+https://github.com/ostermeyer/jmd-impl.git@v0.8.0

Pre-built wheels for Linux, macOS, and Windows are attached to each GitHub Release and can be installed directly:

pip install https://github.com/ostermeyer/jmd-impl/releases/download/v0.8.0/jmd_format-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

The C extensions are built automatically during installation if a C compiler is available. If not, the pure-Python fallback is used transparently.

Quick Start

from jmd import parse, serialize

data = parse("""
# Order
id: 42
status: pending

## customer
name: Anna Müller
email: anna@example.com
""")

print(data)
# {'id': 42, 'status': 'pending', 'customer': {'name': 'Anna Müller', 'email': 'anna@example.com'}}

print(serialize(data, label="Order"))

Document Modes

from jmd import jmd_mode, JMDQueryParser, JMDSchemaParser, JMDDeleteParser, parse_error

# Detect mode without full parse
mode = jmd_mode(source)   # 'data' | 'query' | 'schema' | 'delete'

# Query by Example (#?)
query = JMDQueryParser().parse("#? Order\nstatus: pending")

# Schema (#!)
schema = JMDSchemaParser().parse("#! Order\nid: integer readonly\nstatus: string")

# Delete (#-)
delete = JMDDeleteParser().parse("#- Order\nid: 42")

# Error (# Error)
error = parse_error("# Error\nstatus: 404\ncode: not_found\nmessage: Not found")

Streaming

Use jmd_stream() when the complete source is already available:

from jmd import jmd_stream

for event in jmd_stream(source):
    print(event)

For incremental input, consume the events returned by every process_line() call. finish() emits only events still pending at end of input:

from jmd import JMDStreamParser

parser = JMDStreamParser()
for line in source_lines:
    for event in parser.process_line(line):
        print(event)
for event in parser.finish():
    print(event)

Canonical multiline fields emit FIELD_START followed by one FIELD_CONTENT event per blockquote line. The stream_events() and to_lines() async adapters preserve the same incremental behavior.

XML Mapping

Lossless conversion between data XML and JMD (requires lxml):

from jmd.xml import xml_to_jmd, jmd_to_xml

jmd_source = xml_to_jmd(xml_bytes_or_str)  # XML → JMD string
xml_output  = jmd_to_xml(jmd_source)        # JMD → XML bytes

Targets data XML — OOXML (WordprocessingML, DrawingML, SpreadsheetML), SOAP, XBRL, XRechnung, and similar formats. Mixed-content XML (ODF, XHTML) is out of scope.

See the JMD over XML companion specification for the full mapping rules.

C Extensions

Build manually if needed:

python build_ext.py build_ext --inplace

Specification

See jmd-spec for the full format specification, benchmark results, and design documentation.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

The JMD format specification is licensed separately under CC BY 4.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jmd_format-0.8.0.tar.gz (104.5 kB view details)

Uploaded Source

Built Distributions

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

jmd_format-0.8.0-cp313-cp313-win_amd64.whl (112.3 kB view details)

Uploaded CPython 3.13Windows x86-64

jmd_format-0.8.0-cp313-cp313-win32.whl (109.7 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (188.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.8.0-cp313-cp313-macosx_11_0_arm64.whl (109.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.8.0-cp312-cp312-win_amd64.whl (112.3 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.8.0-cp312-cp312-win32.whl (109.7 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (188.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.8.0-cp312-cp312-macosx_11_0_arm64.whl (109.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.8.0-cp311-cp311-win_amd64.whl (112.1 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.8.0-cp311-cp311-win32.whl (109.3 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (183.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.8.0-cp311-cp311-macosx_11_0_arm64.whl (109.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.8.0-cp310-cp310-win_amd64.whl (112.2 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.8.0-cp310-cp310-win32.whl (109.5 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (181.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.8.0-cp310-cp310-macosx_11_0_arm64.whl (109.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file jmd_format-0.8.0.tar.gz.

File metadata

  • Download URL: jmd_format-0.8.0.tar.gz
  • Upload date:
  • Size: 104.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2d3fc74cd79c8d5544215e498f83183ba88fbb1aca5706c5d5cb9f64c8cd8d2a
MD5 b7f5ace38dad7b11a0fe7a4505ace46b
BLAKE2b-256 f3022de3c927b14ef8b4a4871877fc540ac236363ae839f9eedd54683476b31d

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 112.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 da0cb1d195aef1b0e52ca597fb0b1839875e80c651e1b57852de8f58c9995428
MD5 9ba8b2dcd36051bc2a65f838bceec3fc
BLAKE2b-256 92d8831c0efd57b9fccbfa8859ed0e80713737c0a2423ecf777ffe99c95a9b85

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 109.7 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 9fedebc204dcc65bed1d1062477073708678ca06648aca7161c8e73221615765
MD5 045bf83396fe6f13c4e457653d12efaf
BLAKE2b-256 98c0709947f7bcb9a9c400fb47e2a5ff6a7eb564691309640f5bfab7e6290128

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d7d3fc0498b62fa5f6c22311be7f11a8980a26ffacbd4e31a7219764a712c78
MD5 33add5f3ff643fc7689a8217a2ade799
BLAKE2b-256 e7bff8f13e4c50b926bd5cab5dd4eb1126c7cce91e8cfe51833a42f095cdb3f1

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e6baf177f734a5034431eea5f0ff07f395c6a8fd42348ef0d45ce9323d12c32
MD5 1645a729c0505ce2d653c802323a4daf
BLAKE2b-256 9206cdf481ff613538fb26f372037e1e356373286e47a442e8d1cbab81ace911

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 112.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4e188e3c325c4f7bea575efce3706263ed15306c21f367c00d691d47c8ee1292
MD5 9bdd064ae47594b5a03667c629e8e3f1
BLAKE2b-256 38240da4136cb888cb70fb72b516b7f6d1d50bfa5c99d1f21bd3e1aea8081ae1

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp312-cp312-win32.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 109.7 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 8cf449d2c170af5599b21143b627e57b1030c61bb1fe3ad192684fd006b6422a
MD5 3dc2c4477b1a689802f713378f8bfff9
BLAKE2b-256 24be871b55cfd1045efe878951551d43d4f4d11271a771676f32ce9f7bc9ae8f

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4e05ced87fd116d99e164f82d85db111f70336c01647d690396290148129024
MD5 ae3f696f5af490e2e08a421d4450ec6d
BLAKE2b-256 152d3fb23a19ba8bedf95019ddeb7329206b585222e99d4d60fa471c659903df

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90b02abf26ddda016d4915db3e3cb2fe5c006bb7d276616a59811f8748602560
MD5 3c5c131239693e066f629ad7b57c719a
BLAKE2b-256 73300d103eda286273472529457ab888b5c43455521f888cdd5dc11d82f5235d

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 112.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0d654195c7804a1469d1993160f74ea820a67fa86a5f847628065e9b4bbb9f4a
MD5 8bcc61516ca38897435bfcca0598f718
BLAKE2b-256 f8a16374ba21eced9ba55ac8ab3a5cca372dda2b7fb8583def25702b035b893a

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d614af9ef44593a3262314a9206e166d99b9d4ffbf5d5b5ff06a208cd9aa4002
MD5 7ff41ce8f9d426d67274e6a833754491
BLAKE2b-256 40ff1bfa9e6a12c2cfac7bfb94e92d1e2cb0535710df08171ec638943159c4bc

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b67ecc4fb3f9b669dae164ecb70c552d2f31c4bb367ddf80b2f2e7b6a4d6333e
MD5 da63ea8d2cf945f9e85f9a761a7f8e06
BLAKE2b-256 dbb847616ad5c8c1f7f6adc55829e1086e5faf1f9f6d74cedff6e2d0fa760982

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ddc48525f1059a69080d43cbc8a8ef1fc023516442d9f4af05f1a71506f5e46
MD5 70292a03d8349b9df0a96a0abdb3730f
BLAKE2b-256 71a08bdda75c83a1b74ac7dd5dc44b2f6abe7a931bea6fb685abfbec2bdf7b15

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 112.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f00099c583ee99b39f5b0c377b9bdb26241bed2633e0259144d1a815fd55bafd
MD5 348207930225cd5441a794dfbefb666d
BLAKE2b-256 c331b959460edcef99e05106623f8bb69de827573ebaf9f462a69279e568b727

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: jmd_format-0.8.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 109.5 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jmd_format-0.8.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4fa351bf34c1821c896f12b6676827b5518c97d3a341ea84368b111d33e24ef4
MD5 e544a48444a1298b626eb1ec92635d26
BLAKE2b-256 024a5059791a1c27809477d3487f8bdf644a8dac095a4737e04c6abe8e31ce57

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e37b17bf7fa2435703b088b24f6e2ef89f22768499ca149e86ea8346170149d8
MD5 878f02f97cf8d43224a6a8e447554a89
BLAKE2b-256 80e26aa3ea206ed535bb48d5266df6ccfdd33f995ed6469bcfb5827cd1bf0d13

See more details on using hashes here.

File details

Details for the file jmd_format-0.8.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jmd_format-0.8.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 710e62cc03fd517105058d9de7a161cb720082b76cc7262b1078a3931e235552
MD5 395525166f8d581ae3ead33e427c3d02
BLAKE2b-256 fd2a3f1ca21d43683bfe55fceaa2dfd004b6c45f6d1df3cca5015af1ec76277a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.1

17 files

0.9.0

17 files

This release

0.8.0 This release

17 files

0.7.0

17 files

0.6.2

17 files

0.6.1

17 files

0.6.0

17 files

0.5.1

17 files

0.5.0

17 files

0.4.4

17 files

0.4.3

17 files

0.4.2

17 files

0.4.1

17 files

0.4

17 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page