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

Uploaded CPython 3.13Windows x86-64

jmd_format-0.9.2-cp313-cp313-win32.whl (111.7 kB view details)

Uploaded CPython 3.13Windows x86

jmd_format-0.9.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (191.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jmd_format-0.9.2-cp313-cp313-macosx_11_0_arm64.whl (111.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jmd_format-0.9.2-cp312-cp312-win_amd64.whl (114.6 kB view details)

Uploaded CPython 3.12Windows x86-64

jmd_format-0.9.2-cp312-cp312-win32.whl (111.7 kB view details)

Uploaded CPython 3.12Windows x86

jmd_format-0.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (191.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jmd_format-0.9.2-cp312-cp312-macosx_11_0_arm64.whl (111.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jmd_format-0.9.2-cp311-cp311-win_amd64.whl (114.4 kB view details)

Uploaded CPython 3.11Windows x86-64

jmd_format-0.9.2-cp311-cp311-win32.whl (111.5 kB view details)

Uploaded CPython 3.11Windows x86

jmd_format-0.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (185.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jmd_format-0.9.2-cp311-cp311-macosx_11_0_arm64.whl (111.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jmd_format-0.9.2-cp310-cp310-win_amd64.whl (114.5 kB view details)

Uploaded CPython 3.10Windows x86-64

jmd_format-0.9.2-cp310-cp310-win32.whl (111.6 kB view details)

Uploaded CPython 3.10Windows x86

jmd_format-0.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (183.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jmd_format-0.9.2-cp310-cp310-macosx_11_0_arm64.whl (111.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: jmd_format-0.9.2.tar.gz
  • Upload date:
  • Size: 110.4 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.2.tar.gz
Algorithm Hash digest
SHA256 3b141c5f3567498c4d8299754c15be7888bd4613568b48e9172b4438668c703f
MD5 1d46b9f32ddd831f5ea97b876b9e05ff
BLAKE2b-256 8ba1694315f97f868e92fd91e8262bcdf9313f4b21fabc538c653903229a9a42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 114.6 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4f58ed965c3e08c31cb8e1f164d4cdfdfb81cc4640077a595177107186d7095d
MD5 b35bcd37f716bfcfd78b4f3d03d78ce1
BLAKE2b-256 32861508ae8c5e1f2469c5962ecff192a2404429b868df0ff4c853ad366f0a59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 111.7 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.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 97d054cfae0f94577256179d5f524cb2a0969153c58c6b25ddb5349a32ba675d
MD5 d5abdc2e1795ab4a31c2e04699027d8c
BLAKE2b-256 91f2acc190e69abfcc08b95b0ecbe17eaebc4c3285a67e74532df813ddac103a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ffab6c85d4a5816e91f93ce312b08f22fcd9647b6bbde9403dba68707560e328
MD5 b3df3625cb76d2366ad45f3a8cb4f276
BLAKE2b-256 5e56aa03d768d7d18dc2f371e6a4d7a2965c1e26942adc1224cf4dd07886b6ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffe45703de0f68979ac8105dd7bb78f3ec528ad696ea49e1c71a5694a2c75a5b
MD5 3b9864c3c1236a016f00a7f4a6b1192c
BLAKE2b-256 d4444ec82f780494e930624ac8ea3f5f4b78f4f36771acc28fa60f0ad397cea4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 114.6 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 51ac45763b37170ae20cc443a258da19397024e9de115b5e2e060602cc62c83d
MD5 c4ba7a75187edd497a5b888f253ddeb1
BLAKE2b-256 1b77e13e9912d8dfaa31218b859ce8cb3d06ced3d6ece2402e2327b2ec0267fc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 111.7 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 388f15907cc8d870af4031a47c9a30a4a3bc8d89afb0573e16e68a0616871db5
MD5 72259b5c8f595d8a6c20d7698b33d9df
BLAKE2b-256 283fc37f488c2d38f72f545c1ead8ac769bcd71aaa92b0802b3511357b8166e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68afac22e29676283bef43d7dcc5ca4a82991ca9a9aff7acadb9d379c8b40894
MD5 4045eb44fd25b06f5a6946a625a49723
BLAKE2b-256 f760fa6ba39e84720f869f9549711f7c8f371c628f93716a2f837ef834663efd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ed2115d1694c6e76bdeb35586d5e4a892006c1f6a24640e6b8cf09ba42a3294
MD5 65d16bf9420899061a72d4423774343f
BLAKE2b-256 02392fa13393e0e5ad79bcca28e45ba8140b2e4a0ae0b6fb9417198a1fca7c40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 114.4 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a24df63a8aac549c36182f6b0c843024598ad9b1d073034b69e3c239aca747a4
MD5 d556133482d2bc39f7bbfb2f9046c061
BLAKE2b-256 04cc4c9f03c773ff7875c446b624b127b7227b92388147662af22c6e98a5eddc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 111.5 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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 01f1bbbe062a533353b9fc73969a8ef55137012263971841e8623acf0ab4b968
MD5 2ed2b1d4ca540a7ff33039cb210af41a
BLAKE2b-256 243ade21f67e27d4b48a6f40fb8b4b5969482a349452793b2300b896a2b9fb1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0bebfd025b3b1c4a15c0dc783956b349498bfe2fcc54ce7fc7c03e9d07a9d1fe
MD5 9dcc61bc01d31bcb108854bcdedf0b86
BLAKE2b-256 622c504093fd87eed6f20ca75b5299fb780aa581c20c8ca0726df8d6c4a87dc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee4de7ae13cb17d5255b311182e9bea0c43c33f9fca4ab95734ced8f8b902377
MD5 744a7bbf52ddb8cbff58d2695dd58c67
BLAKE2b-256 d1e07f47456e140c4ee068be213275b3e5ca1abc2adbe57c61acc3ed3676c5d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 114.5 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a373fac10322013837eaa982d6cb792bd6b340743e62f3e190ed7b7fbfb4385d
MD5 b3fce9254249615d51e4ffeb3c103972
BLAKE2b-256 ffcf6714608d5ec6a7347c99f104b62a6bac631ea6ec573b029debbff2a69b9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jmd_format-0.9.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 111.6 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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 366bd6e040d24489caf57a9cd53770417544e8e03be5bbfe62491ba949a668a7
MD5 aa0ac5633818d29a2292d0c394928322
BLAKE2b-256 9a8f216bfae4faa9d5f2686829ecbc31135f06064bd343dee33cd48195befc5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ad982573f2cb20737ccbd18fd13a83f6222212a8a11b47f05de12828af84701
MD5 ee5bd74e8f1cf67c6edba0a89f3f4d0f
BLAKE2b-256 7252d4d58fc2930653e136fad6cafa460507005f634ce6ffe6ac40e5f9e7189d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jmd_format-0.9.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd3ef876da035275b668aa0431eb691553f9ad4776537f04135c3e44713409d9
MD5 cfca64692354e09afed83640df6c3abe
BLAKE2b-256 dbe2d0bf690ccf33314162657ffe491a6348abbba4b0cb9339ac896ea66fea05

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.2 This release

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