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.

Metadata

Release files for jmd-format 0.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jmd-format 0.10.4
File Size Uploaded Provenance Actions
jmd_format-0.10.4.tar.gz 117.7 kB Without provenance Details for jmd_format-0.10.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for jmd-format 0.10.4
File Actions
jmd_format-0.10.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for jmd_format-0.10.4-cp313-cp313-win_amd64.whl
jmd_format-0.10.4-cp313-cp313-win32.whl CPython 3.13 CPython 3.13 Windows x86-32 Details for jmd_format-0.10.4-cp313-cp313-win32.whl
jmd_format-0.10.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for jmd_format-0.10.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jmd_format-0.10.4-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for jmd_format-0.10.4-cp313-cp313-macosx_11_0_arm64.whl
jmd_format-0.10.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for jmd_format-0.10.4-cp312-cp312-win_amd64.whl
jmd_format-0.10.4-cp312-cp312-win32.whl CPython 3.12 CPython 3.12 Windows x86-32 Details for jmd_format-0.10.4-cp312-cp312-win32.whl
jmd_format-0.10.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for jmd_format-0.10.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jmd_format-0.10.4-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for jmd_format-0.10.4-cp312-cp312-macosx_11_0_arm64.whl
jmd_format-0.10.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for jmd_format-0.10.4-cp311-cp311-win_amd64.whl
jmd_format-0.10.4-cp311-cp311-win32.whl CPython 3.11 CPython 3.11 Windows x86-32 Details for jmd_format-0.10.4-cp311-cp311-win32.whl
jmd_format-0.10.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for jmd_format-0.10.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jmd_format-0.10.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for jmd_format-0.10.4-cp311-cp311-macosx_11_0_arm64.whl
jmd_format-0.10.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for jmd_format-0.10.4-cp310-cp310-win_amd64.whl
jmd_format-0.10.4-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details for jmd_format-0.10.4-cp310-cp310-win32.whl
jmd_format-0.10.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for jmd_format-0.10.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jmd_format-0.10.4-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for jmd_format-0.10.4-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 2.3 MB

Release files / jmd_format-0.10.4.tar.gz

Download URL jmd_format-0.10.4.tar.gz
Size 117.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0e05b2d7d5fe7abb32fb77e129a6a6ece0836e41a442cd1aec45f74ba832f30a
BLAKE2b-256 checksum
How to use checksums
bd58ed4dc8e8ec0b7436af0ed6fe690c9218c3b87db31a240981654dbe1a8d4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp313-cp313-win_amd64.whl

Download URL jmd_format-0.10.4-cp313-cp313-win_amd64.whl
Size 119.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a319493166a8a532e8920995676c5f7d642192e69ef690b9b9eec7b5607040fa
BLAKE2b-256 checksum
How to use checksums
a1d838ae81868d2d1e8aa7681854a3f74db95540c3b0a771432628fc289b73bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp313-cp313-win32.whl

Download URL jmd_format-0.10.4-cp313-cp313-win32.whl
Size 116.0 kB
Tags CPython 3.13 Windows x86-32
SHA-256 checksum
How to use checksums
b6d7f627a1a7234b603e3ce6eeb1f1f45967cbcda549e547bcf3b7ebf08f72dd
BLAKE2b-256 checksum
How to use checksums
c4758f3d7de004d61281309c69c3616c48f3a619b66cdc29893cd2a8a37b044c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL jmd_format-0.10.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 198.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
42f3ec1f18341b229043a5c69020dc9f4ddaf846f5ae94f34e642cdb19419c24
BLAKE2b-256 checksum
How to use checksums
a895b078ff883dae2fb28fad338e94bc109f473ff5da4e729c3fd953f66407bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp313-cp313-macosx_11_0_arm64.whl

Download URL jmd_format-0.10.4-cp313-cp313-macosx_11_0_arm64.whl
Size 116.0 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aa7a1dbbc28c36322de79f2fac71c1b141c469dc409a2ea571cb06518fb6fdc4
BLAKE2b-256 checksum
How to use checksums
4c1d79ac37312234b59943faad94c84ce5d5634be437c1a08cea6313602f225a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp312-cp312-win_amd64.whl

Download URL jmd_format-0.10.4-cp312-cp312-win_amd64.whl
Size 119.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
3e5a51385628611b5f7a24223a2adb5314d12a2d6256ac12a243ebff72c06d8a
BLAKE2b-256 checksum
How to use checksums
e1443ebb3d8a9d99edef4176848305d0bc965e96fa140faf992f830d349246ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp312-cp312-win32.whl

Download URL jmd_format-0.10.4-cp312-cp312-win32.whl
Size 116.0 kB
Tags CPython 3.12 Windows x86-32
SHA-256 checksum
How to use checksums
07ce992c91a6d99b26e2a46968331f4f31ed9a0210f826362e000300809bb6f1
BLAKE2b-256 checksum
How to use checksums
7d0f6b43f36f31bc2d5e9ce79aefdb1e08b65541254d6d181dab935f2ae6ad57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL jmd_format-0.10.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 198.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0c58236c83c0c82478ece55808a95be88529f9a14cc3801afcb3454516d76d58
BLAKE2b-256 checksum
How to use checksums
24e2e7fc26fb7719ae3dc6bb3cbeb26308efc01f2df3afe979f228cad5d00039
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp312-cp312-macosx_11_0_arm64.whl

Download URL jmd_format-0.10.4-cp312-cp312-macosx_11_0_arm64.whl
Size 116.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2a0e419614cbab63591385e028967cf6104f0a4c8d2161e35b2b842c1ad75272
BLAKE2b-256 checksum
How to use checksums
e5fb19cc851e28ac226741d31ec89a04d355324aacf38f298646207eed4a2470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp311-cp311-win_amd64.whl

Download URL jmd_format-0.10.4-cp311-cp311-win_amd64.whl
Size 118.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
afd1c7fc5bc3d10f9175a72285f564b252bf64e194e5724707bf13e272cf263b
BLAKE2b-256 checksum
How to use checksums
fbe9d172f99e9484f439bb23d1e309ee1319a23a635b6fbfc371bd5855f397d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp311-cp311-win32.whl

Download URL jmd_format-0.10.4-cp311-cp311-win32.whl
Size 115.8 kB
Tags CPython 3.11 Windows x86-32
SHA-256 checksum
How to use checksums
e7d6e8edf85ba8accc30725a6bb6bb0ce7b9f3763fe05f2a89596f43e6519f10
BLAKE2b-256 checksum
How to use checksums
c38c7879fe675bdc463506aff96714a670e48d41548770c098acac84c998ce25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL jmd_format-0.10.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 192.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
73b211f69c74951c759214260eead0b4539f088fb0c57971d66b8fbe61b7188f
BLAKE2b-256 checksum
How to use checksums
a72102bf9b33c632372cebfa6ec73f0b8eed59769165d0c5d45ea5c338b4b309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL jmd_format-0.10.4-cp311-cp311-macosx_11_0_arm64.whl
Size 115.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0d00fd4c8b3d4e10db9e3e05344f435892721cd265d2bad7a4d49813a7f5cb53
BLAKE2b-256 checksum
How to use checksums
a4965fd505d5aac3ae9fc7bd40c0873d6327fd3cdba399b65af0b48341c8a615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp310-cp310-win_amd64.whl

Download URL jmd_format-0.10.4-cp310-cp310-win_amd64.whl
Size 119.0 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
5d9fb0b989fbb27376f3b2a97cfee6134344b7a3502d782d6c50cd2824b3c190
BLAKE2b-256 checksum
How to use checksums
71da63620ed0cda38238ed78d4b48ff396216d785e433612a576ff417bc2b8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp310-cp310-win32.whl

Download URL jmd_format-0.10.4-cp310-cp310-win32.whl
Size 115.9 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
a6a9cf30e39be1c8e4edb1ac652a2403af3f7b43578695c304327f30cb50c809
BLAKE2b-256 checksum
How to use checksums
f533f83a282f41c33019b36603306a175a2084e2099a68bf51a18f0d20b16bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL jmd_format-0.10.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 190.1 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c488541a3307117a5a1386fe5c92dcbd71c74626ab1b0132d2656f12c2f7eed9
BLAKE2b-256 checksum
How to use checksums
71bd5adcd6c3f655ea5c6aac54eafff487482eafd692a98c31f183b57b16f817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / jmd_format-0.10.4-cp310-cp310-macosx_11_0_arm64.whl

Download URL jmd_format-0.10.4-cp310-cp310-macosx_11_0_arm64.whl
Size 115.9 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6518704344234cf630b3cb32a0f2568a4fbfd3d491e0100cc362ea6424fb2dcf
BLAKE2b-256 checksum
How to use checksums
53b87faab31cee9ca359698e25deb63b2f550515aad04927ec5248a899f19f9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for jmd-format 0.10.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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