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.9.1.tar.gz (109.8 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.1-cp313-cp313-win_amd64.whl (114.4 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

jmd_format-0.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (191.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.9.1-cp313-cp313-macosx_11_0_arm64.whl (111.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.9.1-cp312-cp312-win_amd64.whl (114.4 kB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

jmd_format-0.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.9.1-cp312-cp312-macosx_11_0_arm64.whl (111.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.9.1-cp311-cp311-win_amd64.whl (114.2 kB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

jmd_format-0.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (185.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.9.1-cp311-cp311-macosx_11_0_arm64.whl (110.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.9.1-cp310-cp310-win_amd64.whl (114.3 kB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

jmd_format-0.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (183.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.9.1-cp310-cp310-macosx_11_0_arm64.whl (111.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: jmd_format-0.9.1.tar.gz
  • Upload date:
  • Size: 109.8 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.1.tar.gz
Algorithm Hash digest
SHA256 64a1314b770b7ef4793789377c86243998c5aeb8b888fd6a0abe5197414daa1b
MD5 8aacf545513f89ee5c3807bc646449f1
BLAKE2b-256 4ab006181728379efa54a5e541c6b87998f2966b9a72d4c9e94ab6065a91718e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 114.4 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 49b712776372225f83607ad460ee03952aef32c8f34ab3dfec5af855fe86fe9f
MD5 074349bce3da6e5f26edae08267f78ba
BLAKE2b-256 91770eba068b5338d9e38353ac01f13c1ef1ec188443796a38cc916d7262cb64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-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.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 3efae8e7ce2abfc0ed18dda7e162d23eae0d9aea09969e436de45cae3031a056
MD5 0e2b1bbec576406f47719dae39cc2463
BLAKE2b-256 d58e6058b0a27b8990bb730f5c294573794a74389f8468cce910e5a6672574f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2dca61c075f7851249e76bbaa50ffd611dec42db0c69c7cad1a5c6997bdf1a9f
MD5 b29524b34427debe29d6b6ec88cf992a
BLAKE2b-256 133c84ba0183ed5a06d25a0e631b3893257eea44cea0a2d8287d5037791ab9a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3b32ca99d077e39cfd10b6cb2d77088703d397dc8ac8fe9f138895ed31ff183
MD5 de7d75687e85a8ad298cbbb72ee66ea7
BLAKE2b-256 2d37d25f5ce08e6b2a29e238809c6fe58db241a8b1665d7c006f13dbfff00b9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 114.4 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c3a7e4b38276211dc04b314d6531aaa68a6ccee0e476a933d82aaa5cd5e5742f
MD5 889a0f4eedbf11b271d5a47cf9e37f1c
BLAKE2b-256 55f525fc395012cbf5ec4ec304373aafd512b4be5b23ea789c986784de692721

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 366e2fb6b6d6279711759ccff969e302ac02c1113fb408f6128d701feec45d3b
MD5 4bfb9bc6d9d336ca7e6d27bb0aad94a5
BLAKE2b-256 4598108aa0bb54c6518ddb8e5c415dc24b9d7e7e1788b000295299efcb5026c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 541dcff61530a83472fcf959f34427ce3b6480e5660b4f461199ea13c57e666d
MD5 77fa9f57f9c1bc3f9e2aebe84fdd49e4
BLAKE2b-256 49d55cfd55d2a12b9af32140e4fdab493c349e2238d9dc1036b7873d6753d4dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7c5177d48ed13887d878e3381df678628eb7540a10034bc77e4d1d674cde43f
MD5 93ca85596a73d704a5ba932b5a8d6e02
BLAKE2b-256 e8e609c2542787081857b3340cad198245f1c2a7770eb06e10884c2b58638450

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 114.2 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f475f8c2100c36a7b30148ca1651e61035bb1a815b204422604ae6933bfccdcf
MD5 d1e0382e50bd8544a595889767747e05
BLAKE2b-256 9d2a41b80b229ec8f6850730d1276fc46dd573ffcc62d635908cec1c131e5674

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 84e36a283205cb1db9d754aeeeb3d75cf660612b557e01bb14105a2e226fdfaa
MD5 7ed93b53b70c6ee8504853a7d0e7e0f9
BLAKE2b-256 59c2eff3933ca580fe48065f4b2530a8ab127b998575a11863299f5d0daed9b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82bbb9d52540952110e2239d1758014003a0640ab608edeaa3131459dddbd93a
MD5 da7878b916109bb6f3679210c5053134
BLAKE2b-256 e31a40c1f25f73456f9e8fe182121750e44b214e86eec97b473414c2b72cf906

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e51ae8d71eeddebf0e88cb87f8c7f0c73c16aa7f5adae785eaeb817b9677940e
MD5 ff8b63b3093e4b6fff2a298cb03369b3
BLAKE2b-256 17fbcc0a5fcf95265830cd56ded9be009b1b10aa8ac06d6d6802623fc7ce2f0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 114.3 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a459fc47aa6599463915b32bed5d65c0919c52690b8895eb3519534df74ba002
MD5 651187e394b06a0cc8461eb4b5953eb7
BLAKE2b-256 ddd4c10f31f65100601102bd2b29bc117894333b6edcb1e6a40b97e43500153d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.1-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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 3bb452f98bcf30fa4a70cf9e066d8e5c83a6a74ea3bd818777e28db0367adc69
MD5 84c4f018a3c910dae1618f4560d20a02
BLAKE2b-256 d9d89c248d16bbe3c89423be7d84a8503cc2644eb9a31ab78ae9d92e10cf26ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f647799959f8b5f91091a032e1ecec2f02398d5a1f607aa130ff946ddc290964
MD5 a89fecc1f54e4911525962e40551ff4a
BLAKE2b-256 ffdc2bd5e89829ae6fcc40499acad88cc45ee58ece6dc6e2e89be000eb0dda41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65d2c2d5aa0f9d2afa6c6e8acb7c6776d81467f275924a6b437e136dc4ae1c16
MD5 f53f76588e271e2b555e89dcf2bcee63
BLAKE2b-256 882caff89d3aed019829d653e95aabbff82dc9a26d8d792b0c345c5ffa1b0cd0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.1 This release

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

Supported by

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