prosemirror
Python implementation of core ProseMirror modules for collaborative editing
What it is and what it does
Prosemirror-py is a native Python port of ProseMirror's core modules, enabling you to define document schemas, parse and serialize rich-text documents, and apply transformations directly in Python without embedding a JavaScript runtime. It translates the upstream implementation closely, adapting for Python idioms (snake_case naming, type annotations) and replacing browser DOM APIs with lxml for HTML parsing and a custom Element model for serialization.
The package includes schema definitions (basic, list), a transform engine for applying edits, a test builder for validation, and full type annotations for static checking. It preserves JavaScript's UTF-16 string semantics to maintain compatibility with ProseMirror's position calculations. The test suite has been translated and passes, and the project is actively maintained with recent commits and support for current Python versions.
Use it for:
- Build server-side rich-text editors or collaborative editing backends that accept and apply ProseMirror document transforms.
- Parse HTML into ProseMirror documents and serialize documents back to HTML for storage or transmission.
- Validate document structure against a schema and apply bulk transformations (delete, mark, wrap) programmatically.
- Generate test fixtures or synthetic documents for testing editor integrations.
- Implement document diffing or version control by converting transforms to and from JSON.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python implementations of core ProseMirror modules (model, transform, schema, test builder) for building and manipulating rich-text documents programmatically without requiring a JavaScript runtime.
Yes. Active maintenance, production-stable status, low install friction, no known vulnerabilities, and permissive licensing make it a solid choice for server-side ProseMirror workflows. Install if you need to manipulate ProseMirror documents in Python or build collaborative editing backends; skip if you only need client-side editing.
Install
prosemirror on PyPI
pip
pip install prosemirroruv
uv add prosemirrorpoetry
poetry add prosemirrorInstalling prosemirror
Before you install
Low friction install with three lightweight dependencies. Active maintenance with recent commits and production-stable status across Python 3.10, 3.11, 3.12, 3.13, and 3.14.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
from prosemirror.transform import Transform
from prosemirror.schema.basic import schema
doc = schema.node("doc", {}, [schema.node("paragraph", {}, [schema.text("Hello, world!")])])
tr = Transform(doc)
tr.delete(3, 5)
tr.add_mark(1, 4, schema.mark("strong"))
Requires Python 3.10 or later; UTF-16 string semantics differ from Python's native encoding, affecting character position calculations.
Verify before relying
- Performance characteristics and scalability limits for large documents or frequent transforms.
- Completeness of prosemirror-schema-list implementation (node specs and wrapRangeInList only; command functions excluded).
- Real-world collaborative editing workflow support and conflict resolution capabilities.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cssselect, lxml, typing-extensions |
| Maintenance | actively maintained — 174 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 158,604/month — #10,717 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prosemirror-0.6.1-py3-none-any.whl
Keywords: collaborative, editing, prosemirror
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pandocPandoc Python Library wraps the Pandoc document…
permissive · top 15,000 on PyPI
BabelDOCBabelDOC translates PDF documents between…
agpl · top 15,000 on PyPI
draftjs_exporterConverts Draft.js ContentState (a rich text…
permissive · top 5,000 on PyPI
docxCreates, reads, and writes Microsoft Office…
unclear · top 15,000 on PyPI
spire-docSpire.Doc creates, reads, modifies, and…
unclear · top 15,000 on PyPI
htmltoolshtmltools provides Python functions to…
permissive · top 5,000 on PyPI
adf-libadf_lib creates and manipulates Atlassian…
permissive · top 15,000 on PyPI
doclangDocLang is a reference toolkit for validating…
permissive · top 5,000 on PyPI
pydantic-xmlPydantic-xml adds XML serialization and…
permissive · top 5,000 on PyPI
hologramGenerates Draft 7 compatible JSON Schemas…
permissive · top 5,000 on PyPI