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.2.tar.gz (114.2 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.2-cp313-cp313-win_amd64.whl (118.1 kB view details)

Uploaded CPython 3.13Windows x86-64

jmd_format-0.10.2-cp313-cp313-win32.whl (115.0 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.10.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (196.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.10.2-cp313-cp313-macosx_11_0_arm64.whl (115.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.10.2-cp312-cp312-win_amd64.whl (118.1 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.10.2-cp312-cp312-win32.whl (115.0 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.10.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (196.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.10.2-cp312-cp312-macosx_11_0_arm64.whl (115.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.10.2-cp311-cp311-win_amd64.whl (118.0 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.10.2-cp311-cp311-win32.whl (114.8 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.10.2-cp311-cp311-macosx_11_0_arm64.whl (114.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.10.2-cp310-cp310-win_amd64.whl (118.2 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.10.2-cp310-cp310-win32.whl (114.9 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (188.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.10.2-cp310-cp310-macosx_11_0_arm64.whl (114.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: jmd_format-0.10.2.tar.gz
  • Upload date:
  • Size: 114.2 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.2.tar.gz
Algorithm Hash digest
SHA256 8f804fc4eac7f1c9bd36693c6b323700e60bbbd8bfd35786f88db7c96c3d1bc2
MD5 7dc93bce9ad1eb353c9c5fd5b34c014c
BLAKE2b-256 24cd1a21849cf7cd8f923c861ba05ae6dd204008024e43e5e5ff78ac1c11a514

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 118.1 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3a0175d226d681e63115c372119dd3a5363eb060cbe911263d22a99e9ab9a835
MD5 91129074a79ad04052c5aafa11b63f95
BLAKE2b-256 33dd6ad65409743fda5350d3bbde32cb9b14234dc25bad7ed86bcddf73bfb8d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 115.0 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.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 c1e22a7529def2c1878d225ca49aae53a3c83e54dc0c0bb5489cf846cb15a56e
MD5 0aff93c620571d63d8eaacd455cf51d5
BLAKE2b-256 0644186110d489f8b1de975c9d2eb442b9282b2ca00559dc6095d56cdc7e937f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61a99adebafd09096c179095692f3c92a62478898f32d54bc9bdad60b2a347f2
MD5 e068454501fa7b4f5d93a96fac26edec
BLAKE2b-256 b50a546a6d72474ff61b50b5292bb8b12d96475af8d86389931921ef185bb4bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ac846f285e7e6b2ae22bde2147daf4ebbdfb39f9f8e45a28e16d6525b0d7480
MD5 0fffcb984120e4791af9d9807f8c1f82
BLAKE2b-256 934a6dd9fab8508daba997557de8cc7e61fd27cbdef491382a397abb097646d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 118.1 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0b2c28d825ae93070d6efbd6190a6b1f57e4a495ed4adffbab7ab50815022f0b
MD5 ed84a38c41f73ba17069461acab273e3
BLAKE2b-256 01e3c6fe5aa45daab256dfd0f5e5e3a622f04d1c25475b55a36fcf8e06a4692f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 115.0 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 c27b785607ac7e2f44d1b459a665d0a8d5187e8543179780e8a290150b4e2412
MD5 be7ef186a86fcdcb46749e9e50fe37fc
BLAKE2b-256 5f72eb157de5e9b558c0ac7016db0ec35c13495dc01d6c54107ab767ec8bced8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02309705226e38a593bea8558423290596d692a166e8ed4ba60789d2a1688cea
MD5 295c3ad9f7c85112112f5d616d939d8b
BLAKE2b-256 e0789cbd6dcb29b231244530c88cf4a6cca8137bd2d4b7a7e4640646aba8b40a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b06b67551a65cd3bec7e4a5bf505f54433e61611323d40fb6ba077bb4253c83
MD5 393e13f3405a9d8883cdfc4a3def86c7
BLAKE2b-256 0f2602678d1b16c80b50e725bef25ff4424cc248b51138f11aed77d02e89c5f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 118.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.10.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b5a360d5947b4a4a40f65bb497d2190ae203f88c9a1f0c1b15ede9ea26132b14
MD5 49d0a075d13673561c436c04fc32f669
BLAKE2b-256 9e9299a09bba607083b3cd76eb4c9ae1444bcf3fe954f7d43a9101deb2c3dcd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 114.8 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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 646fb5dc54c495ad5cb7ee356ad1871568f2c9c9ac077fd19ab61ebb89a76ade
MD5 7c2c9d489320e5caa74857152c92b627
BLAKE2b-256 a628982afc8e534de91b30c5b918e1c85a35886365a458375ed614abee556a2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d7f287035202252bd94ec5769fc3869efa848db284d38fa2226cd8d43733630c
MD5 7db90c52049c749ac3ae1fdf425a97ea
BLAKE2b-256 7ef37cb26503584ab5994becccf6036630227563ee97a262792546b93c5d9cf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28c1f18a79d58a373a64def4cecb82355599e26f9d08d29087b7634a9965d8ed
MD5 d82112fb1aea8db633b033fc5392b0cc
BLAKE2b-256 e1ac25df0b34b95c085e40c027a529655acefb0e7c21271de1c214ee21f3f3df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 118.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.10.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 30c02361898d17d43be4dc1d63bd704e8250009c14353f3c7434f44d8e569f40
MD5 4f7d73796805b7644040df883766f836
BLAKE2b-256 6a711e73d23a420465d5406a78f06ccd8232a7a2f79fcc5e9a11d5b22a6a8732

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.10.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 114.9 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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 36ac872a7f78a34ef690ff5ce0261b3ddd106ddf6a22727773b969505f8490db
MD5 546054b9c2383467becf63843cdf529c
BLAKE2b-256 40b8849d027e0f82ef1fd3bfce54fab006e442a4daff98e6dd12a4883745378a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26a7d3155f79afe7f7bd98203d97af3ce6cf17e885653fc7cdd8b9b8e5c2db49
MD5 d5fa8ca635732107345824dbea35e034
BLAKE2b-256 6eacf634ba9a4152c7b671a5e302979ec4a787499788940ac948088ffae0e8ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.10.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 096bd233ec4efbaf4d1cf3e10b9ed35eb63ddc40e1ba91ee348fd89efaac5ce6
MD5 6cd82b9261086f94569b2cb43995ffab
BLAKE2b-256 7d7c366f9ebc402dd04c4154cfbdc20937abd2fa11f58e5e420ad12780d1d21a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.10.2 This release

17 files

0.10.1

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