Skip to main content

prosemirror-rs — Python bindings

Python bindings for prosemirror, a Rust implementation of ProseMirror's document model and transform pipeline.

Installation

pip install prosemirror-rs

Design goals

  • Zero unnecessary copies. The schema and document live entirely in Rust memory. Only JSON strings cross the Python/Rust boundary.
  • Wire-efficient. Steps arriving as JSON (e.g. from a WebSocket) can be passed directly to apply_steps_json() without any Python-level parsing.
  • Database-efficient. doc_json() serializes the document in Rust and returns a plain Python str, ready to write to a database with no intermediate Python objects.

Quick start

from prosemirror_rs import Editor
import json

schema_json = json.dumps({
    "nodes": {
        "doc":       {"content": "paragraph+"},
        "paragraph": {"content": "text*", "group": "block"},
        "text":      {"group": "inline"},
    },
    "marks": {"strong": {}, "em": {}},
})

doc_json = json.dumps({
    "type": "doc",
    "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Hello"}]}],
})

editor = Editor(schema_json, doc_json)
print(editor.version)   # 0

# Typical server loop: steps arrive as raw JSON from a client
async def on_message(raw: str):
    data = json.loads(raw)                          # parse envelope only
    results = editor.apply_steps_json(              # steps stay as JSON string
        json.dumps(data["steps"])
    )
    if all(results):
        doc = editor.doc_json()                     # serialised in Rust
        await db.execute("UPDATE docs SET body = $1", doc)

API reference

Editor(schema_json, doc_json)

Create an editor. Both arguments are JSON strings (schema spec and initial document). Raises ValueError on malformed input.

editor.apply_step(step_json) -> bool

Apply one step supplied as a JSON string. Returns True on success, False if the step cannot be applied (document is left unchanged). Raises ValueError on invalid JSON.

editor.apply_steps_json(steps_json, *, stop_on_failure=True) -> list[bool]

Preferred method for incoming network data. Accepts a JSON array of steps as a single string — passed directly to Rust and parsed there, so nothing touches Python's JSON machinery. Returns one bool per step.

editor.apply_steps(steps, *, stop_on_failure=True) -> list[bool]

Convenience method for when steps are constructed or modified in Python. Each element of steps is a JSON string for one step. All steps are parsed before any are applied, so a bad JSON string raises ValueError without mutating the document. Returns one bool per step.

editor.doc_json() -> str

Return the current document as a compact JSON string. Serialized entirely in Rust; only the final string is handed to Python — suitable for direct database writes with no intermediate objects.

editor.version (int, read-only property)

Number of steps successfully applied since construction. Use as a document version counter in collaborative-editing protocols.

Credits

The underlying Rust library was originally written by Daniel Seiler (Xiphoseer, me@dseiler.eu), who designed and implemented the document model, transform pipeline, and runtime schema system. Mustafa J (mustafa.0x@gmail.com) has made substantial contributions to the core Rust implementation. Currently maintained by Johannes Wilm (FidusWriter, johannes@fiduswriter.org).

ProseMirror is by Marijn Haverbeke and contributors — see prosemirror.net.

The Python test suite used for cross-implementation validation is taken from prosemirror-py, a Python port of ProseMirror originally created by Shen Li and maintained by Samuel Cormier-Iijima, Patrick Gingras, and others at Fellow Insights Inc.

License

MIT — see LICENSE.

Copyright 2026 Johannes Wilm Copyright 2025–2026 Mustafa J Copyright 2020 Daniel Seiler Copyright 2019 Fellow Insights Inc. (prosemirror-py Python port) Copyright 2015–2026 Marijn Haverbeke and others

Metadata

Release files for prosemirror-rs 0.5.2

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

Source distribution (sdist)

Source distribution for prosemirror-rs 0.5.2
File Size Uploaded Provenance Actions
prosemirror_rs-0.5.2.tar.gz 186.1 kB With provenance Details for prosemirror_rs-0.5.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for prosemirror-rs 0.5.2
File Actions
prosemirror_rs-0.5.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for prosemirror_rs-0.5.2-cp314-cp314-win_amd64.whl
prosemirror_rs-0.5.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for prosemirror_rs-0.5.2-cp314-cp314-macosx_11_0_arm64.whl
prosemirror_rs-0.5.2-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details for prosemirror_rs-0.5.2-cp314-cp314-macosx_10_12_x86_64.whl
prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl
prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Total release size: 5.0 MB

Release files / prosemirror_rs-0.5.2.tar.gz

Download URL prosemirror_rs-0.5.2.tar.gz
Size 186.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1977c535fde8ef45222387400af3253d432522b2561575756b394ec5d94d9d42
BLAKE2b-256 checksum
How to use checksums
c19035471de90499803d1a7def76be558724e250f420f104f4646caf130e1e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / prosemirror_rs-0.5.2-cp314-cp314-win_amd64.whl

Download URL prosemirror_rs-0.5.2-cp314-cp314-win_amd64.whl
Size 827.8 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
583ecbdb6874dd18e81d13a2a87eb939c5bf59fe8bcb167689b3a94a8e6c2c17
BLAKE2b-256 checksum
How to use checksums
c6bb19a7f053c82969be02b6163f7fd2b01a1eafbc13e6fca23fd4e2c58c0822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / prosemirror_rs-0.5.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL prosemirror_rs-0.5.2-cp314-cp314-macosx_11_0_arm64.whl
Size 931.4 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3b59c803358376569ab7143072c77727f89dd32075582cb70f91550e942f6660
BLAKE2b-256 checksum
How to use checksums
b5f31c5fa57b75dd6b859c39148f74e3e42c74647856023cc01d77e3be606e30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / prosemirror_rs-0.5.2-cp314-cp314-macosx_10_12_x86_64.whl

Download URL prosemirror_rs-0.5.2-cp314-cp314-macosx_10_12_x86_64.whl
Size 966.2 kB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
597a0ba130ebd96fa0d152af8da6da8ec6e0aea85e020744d3280ac08a2520b3
BLAKE2b-256 checksum
How to use checksums
44b4211e97ca27f3d352a01b20210a52580440a3069e11791919bb1eb6058f7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl
Size 1.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
44ff65c9c2dbc4ad5baf576b02c66811509dae44b6e512f5a11e4f95fd26a6bd
BLAKE2b-256 checksum
How to use checksums
62eb1295239d7b456a88042f80420b8a8596aa619531d2b26808403519eb9ed9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL prosemirror_rs-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.0 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
211a8a305bb34acffedd6f9fa210f3a17e0e121d808e5309c03efdb858b8b198
BLAKE2b-256 checksum
How to use checksums
5ae96e6dd8857f5f368ba4e5252cd55a17ed907c6ad73bd799919fcda14be061
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Security for prosemirror-rs 0.5.2

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for prosemirror_rs-0.5.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

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