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 (
    JMDDeleteParser,
    JMDParser,
    JMDQueryParser,
    JMDSchemaParser,
    jmd_mode,
    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 (#!) — canonical structural parser; values remain raw strings
schema = JMDParser().parse("#! Order\nid: integer readonly\nstatus: string")

# Optional legacy type-expression dialect
typed_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.1.tar.gz (113.1 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.1-cp313-cp313-win_amd64.whl (117.3 kB view details)

Uploaded CPython 3.13Windows x86-64

jmd_format-0.10.1-cp313-cp313-win32.whl (114.2 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.10.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.10.1-cp313-cp313-macosx_11_0_arm64.whl (114.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.10.1-cp312-cp312-win_amd64.whl (117.3 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.10.1-cp312-cp312-win32.whl (114.2 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.10.1-cp312-cp312-macosx_11_0_arm64.whl (114.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.10.1-cp311-cp311-win_amd64.whl (117.2 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.10.1-cp311-cp311-win32.whl (114.0 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.10.1-cp311-cp311-macosx_11_0_arm64.whl (113.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.10.1-cp310-cp310-win_amd64.whl (117.3 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.10.1-cp310-cp310-win32.whl (114.1 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (187.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.10.1-cp310-cp310-macosx_11_0_arm64.whl (114.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: jmd_format-0.10.1.tar.gz
  • Upload date:
  • Size: 113.1 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.1.tar.gz
Algorithm Hash digest
SHA256 4f9ebabb9bf819aab76fd5313a51941984e81c189a3e5ae38121e7b8016d1540
MD5 f39a66a0a415caa30f6d392261c30f85
BLAKE2b-256 dd92349a757e597a3f2f2596b2c1b0dbbadb20ec205d8eaa38949a80bfe7fc0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 117.3 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7cafd00a1f712e2cb0c2f239d36d5851c7b6497ad51ebae8ecc063afabe04b85
MD5 8f9adc6237390ec4a234b8610a2462ec
BLAKE2b-256 b22a3422dea016467cc838fa0bf7ae2280cdb7b2a0191ca245840142a7eea0c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 114.2 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.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 060d395e0cc6696058e79ab5791f80eb1c3d19a106f13b6533a38bb67a5807bf
MD5 745110ff444f049310f8987e97a8dbf0
BLAKE2b-256 24795b2b06c1d6598d4fda5d1923f8578c3853f442e32c1553e1ad662bd6d073

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a4e653cf818e4a21cb50acc1b4677208f2be2725e6ac400d6f08139409ba2ee
MD5 27111e6842a4cca6109a73e5ade94112
BLAKE2b-256 7907ab8b4df6c9bc3b520b31f1c8cccfe381960b863097084800b81262ba35e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec0f0fb0768a0a48314348d71d8beb386dbdd695ecf117aea724fd7ebecdbe5a
MD5 7b002ac5591c0274ab7fde7826a89e78
BLAKE2b-256 54fe5be39d8deebedd8260f3a99b347104729ad8fcae2819459f2218c0343b92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 117.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.10.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9f1b2bf700721cf89381676f2d5b971159d10c262a4f6752dd13c54d685b3d01
MD5 b6d90e411e62809dd56413582142241a
BLAKE2b-256 23df6eb597100eb7b39d3516efdc4a767040631921a966e2810edf73c24cb778

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 114.2 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.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 bbc4d3ef8e6ec7f24bc62c28809b014820356f90b437928eb6ce7073ce5af672
MD5 66dd7c8ef3309cf5f3f65997ebd402d6
BLAKE2b-256 beb4e3f939ade9150a216ec861ff6bd7998bccd9a21e28d2adf505fb7feb68cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a41d45ffbe9fb6963a88e940a742410bedef56c536594942d5a2116b38cabafc
MD5 c00c657cb58a1dbc372d662d115542ec
BLAKE2b-256 8c64f16611d156a6b2b7af5ca1513f7cd0633e868f803c20c32736c8630f2b20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3450031579d10ace1886e791a294d54e07820be906499404a5a098216107d8e1
MD5 03d8a975867ffd984896db376fb3766f
BLAKE2b-256 7b53f004f3b3a05fc1e702313957145a6bac28a56ff33e91d16017502d1ddca7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 117.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.10.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c02cb9bd162eba466262852cbb40cce93e4a6c8054275506f71be90cf22c7738
MD5 3591b572dd319925cb7a32d8aceaff83
BLAKE2b-256 d2e826c9f36245531edafff27f1084c1f1dfc8a38486d697f155aa91ea085460

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 114.0 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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 ce81bc4a46f2d8e30928303b5ef69618a477581826d26c057155dfc34b978600
MD5 67a6ac68efbba8e26f9a96601806e3df
BLAKE2b-256 02b361cd30d51cd84ae29b9b2254eb7a557ce2d42e7fd52ab84011053148a931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23e0955e60ded4e59beda4bb81fbe090e4415d1c67460ab83e4deb935d689fb7
MD5 d0a17550af7bdf46c3f49d61e81d8da6
BLAKE2b-256 8b8aa252019620ceaa679e3418c3c08f64566770095ebd9dc58c3aa02a204f85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0282422720f2645439ae8a92e643f9b93b3c5c1f11494b38f4d323b157b18394
MD5 9bf8f01d317438f397ca4bc8bd9921f0
BLAKE2b-256 9c664a8c9c98f0f36a4148c1345de2b260f171b219aa4e55be15bdfdd27d7af6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 117.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.10.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7558c340842a5e7d96808f8c9851f4805f4f584da3ec31da7ef8ae930a074e65
MD5 d460584ced6237311b3ea6a133106d0b
BLAKE2b-256 c8f2a98d540099eaa1cd8546edee3373ebd139bddd8c1f37102714ddda50e59f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 114.1 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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 50b8b48c031f0b04290e968c6258acd1ba13ec85730fa053a0a4faac4253e535
MD5 f8383cc60410d80302be9c772b0aa6d2
BLAKE2b-256 72d346d6a37e85d3cc73ff096f8389fe13de0f7fffcffe5bedaf5a0108f18685

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e32d0cfc2e654367804b2cfef75d98a6d06d9e2d7050c3d42e0d1237d598dd31
MD5 010aa6cb366234cb412807349d81cc32
BLAKE2b-256 3e81ac0d30c20cc6f97709090b08961590971dce8f1f158f9d2a81daf4915002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 96910504f2a3e040bb28ed69af9619462d665b94ad35961b08616a01a6bddeb3
MD5 b19411aa6f8bb0d63f2ddc0a527dc239
BLAKE2b-256 a8a68526573a7505db8a82a6d8bba2046ef3cb354a732f5df54f36a306fbb626

See more details on using hashes here.

Release history Release notifications | RSS feed

0.10.2

17 files

This release

0.10.1 This release

17 files

0.10.0

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