Skip to content
loro-devPublic

About

Python bindings for Loro CRDTs

Topics

Resources

Stars

29 stars

Watchers

4 watching

Forks

Repository files navigation

PyPI version License

loro-py

Python bindings for Loro CRDT. If you have any issues or suggestions, please feel free to create an issue or join our Discord community.

Features

  • High-performance CRDT operations with Rust implementation
  • Rich data types support: Text, List, Map, Tree, Movable List, Counter
  • Python-friendly API design

Installation

pip install loro

Quick Start

from loro import LoroDoc

# Create a new document
doc = LoroDoc()
# Get a text container
text = doc.get_text("text")
# Insert text
text.insert(0, "Hello, Loro!")
# store the `subscription` reference to prevent garbage collection
sub = doc.subscribe_root(lambda e: print(e))
doc.commit()

Development

Prerequisites

  • Python 3.8+
  • Rust toolchain
  • maturin

Setup Development Environment

  1. Clone the repository
git clone https://github.com/loro-dev/loro-py
cd loro-py
  1. Install development dependencies and run
# choose your python venv
pip install maturin
maturin develop

1.18.0

Uses Loro core 1.18.0, including its import validation, undo and text correctness fixes and performance improvements. Existing Python APIs and supported platform matrix are retained.

1.17.1

Uses Loro core 1.17.1. Adds LoroDoc.export_pending_updates() to persist received updates waiting for missing dependencies alongside a consistent snapshot. Restore the snapshot first, then import the pending bytes. None means nothing is pending; clear any previously saved pending bytes when replacing a checkpoint with None. JSON export keeps returning the existing JSON string and reports history decode failures as Python exceptions. The state_vv property retains its existing type.

About

Python bindings for Loro CRDTs

Topics

Resources

Stars

29 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages