skillfed

prosemirror

Python implementation of core ProseMirror modules for collaborative editing

prosemirror v0.6.1 158.6K downloads/30d#10,717 on PyPI62
Permissive license BSD-3-Clause Active released

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 prosemirror

uv

uv add prosemirror

poetry

poetry add prosemirror

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

prosemirror python portrich text document manipulationcollaborative editing librarydocument transform and schemaprosemirror schema basictext editor document modeljson document serialization
collaborative-editingdocument-modelschema-validation

More Python Modules packages