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.9.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.9.0/jmd_format-0.9.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.9.0.tar.gz (109.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.9.0-cp313-cp313-win_amd64.whl (114.2 kB view details)

Uploaded CPython 3.13Windows x86-64

jmd_format-0.9.0-cp313-cp313-win32.whl (111.5 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (111.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.9.0-cp312-cp312-win_amd64.whl (114.3 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.9.0-cp312-cp312-win32.whl (111.5 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (111.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.9.0-cp311-cp311-win_amd64.whl (114.0 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.9.0-cp311-cp311-win32.whl (111.3 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (185.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (110.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.9.0-cp310-cp310-win_amd64.whl (114.2 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.9.0-cp310-cp310-win32.whl (111.4 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (183.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (111.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0.tar.gz
Algorithm Hash digest
SHA256 909516d64d840c3eefc0a2b43d2d9c6436bd4592d3c33904742e9b58f746844c
MD5 ea53b3905c8ab7292530acb205c19318
BLAKE2b-256 30dd8767da8a6e542e14d3566439c4901aa35a65b7fb0c576a2cc40a904fd5e8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 18db5c3c45768d4e767d4591362e1e0638d3ab7f7d448ef4e111ee714e11bd0a
MD5 cf4a1503502ccaca331c6a7dd1274470
BLAKE2b-256 5c16e8b26c64fa18b173c1eaf7b3b1049e958af3aae5e31ad166da1ac7a62596

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 9f32da5419fa0e41d4ca1e95a53e9746c8ad10176f15864b0c568fb761c8d027
MD5 65b565dd53d1e3c557667d75e54c6494
BLAKE2b-256 c3d8780bb8923be99eb855cdd926b2463343b0a78247c1e3cf74aac01af0761f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3f1022d167af5e5b9ae56f955c073e69a201c1597231c328f94c392675e41b8
MD5 2e978a5e1f17f6acab9570dddf0dda5d
BLAKE2b-256 713c4e3da573011672a636d6bc05a2a7e25ea298959a1954fac3a9795df8b3c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0446773f0f908b0f4143c3fb3c05015c79b2ff72a170be07c518c563b7101ab1
MD5 bcb953298b80e9d0efa6abe67d6daf08
BLAKE2b-256 fb53055e4dd0b8c70bbc79fede7486b5982fd804f6db335b22813bbe66a3b49e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 02027237b6181ac618fe8f133748592078bf5a5f81ae5e045016c8b0393c3343
MD5 b7261cd8094c7f20f265f2d4abc79302
BLAKE2b-256 dc5a70f97e8f20debad57f50c2814a7d1510f1ee0f082e087d2199ceefa6c6fc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 02da903ae320c66a84b998c59c8146985f78c9d1b978f395a5d72be5debcd81e
MD5 a8ac06c2a0a4289be683dbea7c38a7fa
BLAKE2b-256 cdd49d8258a3879d73836cd150a0237b74b1974ea72a4458e542afde92fe649a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc4bdfa6cf7ec662251d772b5a8253af203b964665ba270f0ce025baeac8c8a5
MD5 aeafba6a1a91ae845556a346b9641c31
BLAKE2b-256 800ad7080ea4adb5aa6b65a80ea4ee9fa401a5266030f1e512ef4d263a63702d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 017b42c53ad1279f60a032763dbe65355f009618a89c410bf7389c986349f965
MD5 ba8286bd0ad2de334bf36c8568da4bf2
BLAKE2b-256 a489dd7be6391deb2731d30c140840543028ffe5f682d3b30f6afbb1de0b758f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 49da06b7f360dcb7d2c687bd35b9236a44ea573cd6b77a4225a5388fe1741ddd
MD5 158c5994bfd2812d430cef1570d7ae72
BLAKE2b-256 2b6b683e83030a18ea4a187557fd3b991454a9dd365dc3bbb5c86b7cc7b3bf72

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b30c69cb4d9c20b77d20c110f955befcc2049d0467c7cb5a9fe497a901748c38
MD5 cabda09cb980ce9c66b05ee876af9562
BLAKE2b-256 2eed129321875c8b34174dfbf0aea60b8caee0013b26ca13ef21cdc77b7b6a87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 841050f24dde5c592687986b95e16be7185d25138b7ca1dee46cd4eab646456d
MD5 658b22760ad11c21bdd68a359d6996e7
BLAKE2b-256 dfda515961d9fd22cdf2a622a8b920a4c073c7816d8443450a94a2a6ac4a833a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c94d68129fe1a954b1b81c3d34080590c72404bc683fefb8c858732901ee88a2
MD5 885c64f0b53af0801fdd6a2855f90bd5
BLAKE2b-256 b0efdb578e170f8c68a9eba061afb43c4e3056d5a9a729acd7927e349f55a96b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2e9078ca5c16fe71ec51db7103ecfed0619cf3e91f85dba377f450a010065342
MD5 7127856efd43506bcad3b249e15e7fbf
BLAKE2b-256 495b928c4c176bd0aa308afeae54e71080ff9dabcf5e4107135201c3960d99e4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jmd_format-0.9.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 00bc240ce0ed55955cd22196d46bf94b88d53bbfe39728dfcdee94f1fca10999
MD5 09618f8a22550ce8ae58e0ea895e98af
BLAKE2b-256 d5987ba5a37172b0abb825faf3c6c715f49adff4b227c867e93f454d6b42b915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab8cdd3732f5e8b1f632eeec66dd25a9a215dd8c714c8c2c12d30a359d151f09
MD5 1c6c0b87200ad07a5ea26f7dff2fade5
BLAKE2b-256 fd0f65a58c216538ea8f2ea7b20f44184ddc08263c3eeffde0501b8a62023ed9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e0e606d393c61238fce9e08a7b2c633b3e93a097db2798dc9e702cfa12a49c2
MD5 027016814de486ceef725c01af5b3523
BLAKE2b-256 5bbd48947c452a9263c6b238decc6519998a00de06dc156c269dde6923938fa2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.1

17 files

This release

0.9.0 This release

17 files

0.8.0

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