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.1

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.1/jmd_format-0.9.1-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.10.0.tar.gz (112.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.10.0-cp313-cp313-win_amd64.whl (117.0 kB view details)

Uploaded CPython 3.13Windows x86-64

jmd_format-0.10.0-cp313-cp313-win32.whl (113.9 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.10.0-cp313-cp313-macosx_11_0_arm64.whl (113.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.10.0-cp312-cp312-win_amd64.whl (117.0 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.10.0-cp312-cp312-win32.whl (113.9 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.10.0-cp312-cp312-macosx_11_0_arm64.whl (113.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.10.0-cp311-cp311-win_amd64.whl (116.9 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.10.0-cp311-cp311-win32.whl (113.7 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (189.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.10.0-cp311-cp311-macosx_11_0_arm64.whl (113.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.10.0-cp310-cp310-win_amd64.whl (117.1 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.10.0-cp310-cp310-win32.whl (113.8 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (187.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.10.0-cp310-cp310-macosx_11_0_arm64.whl (113.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: jmd_format-0.10.0.tar.gz
  • Upload date:
  • Size: 112.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.10.0.tar.gz
Algorithm Hash digest
SHA256 5d391ef1a2cadf58c4fa165fda4adc93948153199a48448b1ff8802fc0d523aa
MD5 6cc3732c22fd602dce35a513174bb4c8
BLAKE2b-256 f42bd67b6c5e67a0940d2622411f9bf8b621b1138f8fb78b106546089360802d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 117.0 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.10.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 86bd42bf49ffb50a62dc395d50c4d39def4e4b68501d42f6c0a80d99cf337846
MD5 507325bf309d73d2177244fa33dc3492
BLAKE2b-256 9719f17e4b259f9f0b098badbbe1fae95325daf76ed372021e6a6f1cbdb8dba2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 113.9 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.10.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d0cddf967b90129308ada10e5f66ed765ac7542fc124247bb4f0bf2f97476ab6
MD5 a4ffa7147191f358535d7598d329ab1e
BLAKE2b-256 2fcbe1da55b5644e9571a8688591a14e2317ea4fd2af70f6d05e746a5ba15453

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ae49b26f5b064732668b8c170668dc74367c4f07e039501889f0421523bd541
MD5 a5e18a3722a79fc3a3ec4acb6e1249b1
BLAKE2b-256 4d969b81baafa643585621ec8f3e12005b8fe5f0726eb71198fa9f4550b11c9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6382ff0f6270973463f39338a2f31b99c1925ddc4d70ebbc56a0f2e6ed4d1623
MD5 32f2f5dd1d847a7c674a7e0557d0f76c
BLAKE2b-256 6e05efc196ac26f78af02be5bdd1080dc3583a2aca79cd44253a706d45278315

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 117.0 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.10.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a126658efaf457cae59c2a7749f2f0f620500a9c8225394e250edeaffa5026f3
MD5 1daa85cd79e0130bd6a5052e25a054c4
BLAKE2b-256 d88da06d2ff0cdf3d1b80726e8355ba0c02e50e2a39ad629cedcdee54dc09a31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 113.9 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.10.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 85d2646219a5a09a8f4d311d562f2fc3a41cadbd3dfa28d959553cc0e297d0f7
MD5 ae9b27f04c6feaa1e23430692549c27e
BLAKE2b-256 2857e219119d61e1ade3d6b5fb0ee1cef47b25da7401458ef0e2795789370993

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 360f29d3c49232e929d9e041c1a61bc8a42e61b6543f7a0bffa3161734051eaa
MD5 a4db285249281e7abd14a06263ba2927
BLAKE2b-256 c7a4400beb6187b18f7d6dd6bd3fcb9ead7c0a1228bd963f41e1cee0657dac35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b04b0fc6e744cd413f3a92d67150caa97b25582c96631986a53d264dc919bf71
MD5 961ee41f96878551d998f3d14fc795be
BLAKE2b-256 cfda81fff21d4d5dd042bdade9ca80c343d5abdb2ddbe4adf569e92069fe0a70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 116.9 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.10.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 605c92d0d5c415d58e10d88e154c660bef4a509e4178485edbabd42860ede15e
MD5 cee879e2bba2c45d371756f792d7c9e4
BLAKE2b-256 7dc2d40e4804c50f95fac63a195e36582e53d1aa4aacab6f9cb1522fb554a055

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 113.7 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.10.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 6968130926103d509f89cfdfb3a5e8df54f0b55cac0e545dc6a7daccc2f73915
MD5 ee141073d555eca9ab8bd0e50ef4dfd6
BLAKE2b-256 e0885b4eb2a1f25834df5a4e1d6a936f1d4a381a9cde7fa73e470e54dcc66fd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 384371c9ca377903bde21db937dc9d3616d85d1069a8461e9845e77c46ce120c
MD5 0666e9ffe3cd9d9ae2e0b6cb32fd9875
BLAKE2b-256 9f502946c91a4f5e477231ede5d01df01c40b013d12a7a8f8f0a1cfc19bcd59a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82df079c08096ec92fb0abe9e3a9ea119a4c1bee06ff9afbe4c0cf9d3650c1e1
MD5 b627f5002cfee274f1fdd2c36f87d54d
BLAKE2b-256 eb3cabda63ce73fe9d425bbf758e61f618699c17cab1f654578964b559d18426

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 117.1 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.10.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 26626690ed0f89e3d956cff92bdc2d3bcfb10a5e5907c76d1e5210fde1f4d637
MD5 f9ca095237fa74c86157d1bbafe8068e
BLAKE2b-256 fe8f9062fbab59ec8db6deeae42fad645600728addef5204f9490221384a6977

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 113.8 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.10.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1371e05baacd4ba37d59d271e349cc719ddf9e80afeb99b40bee608711ace3c9
MD5 5239ca83cc8d024fb6c58b7bcc4a0a25
BLAKE2b-256 532f78bbcfc97c71f693d28279d9227499cb0d3e7bb26343081d6ee751342b65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bfbb950b7e34cf2f70964756ac8b7271ce2bc32971f1fdef0dd3a5476c2b45d9
MD5 bc2b946d07b47a6d0e764ca5b0275b99
BLAKE2b-256 b1b4610e13a7eec7029b929131f51c9bace4b2b4e33d15124c014220a172c509

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3780c1bb4f98b41668702baa1c5a2be63e18d51a0a28ca2b44250cf96587ced4
MD5 6bba8ec82d572420e7b9a8df5eef141e
BLAKE2b-256 cd16b42bff5b7fa39250d551c617c71ed7dc051012fd6a2c56f33a77cd7bc56a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.10.2

17 files

0.10.1

17 files

This release

0.10.0 This release

17 files

0.9.2

17 files

0.9.1

17 files

0.9.0

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

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