Give AlbumentationsX a star on GitHub — it powers this leaderboard

Star on GitHub

loro

Python bindings for [Loro](https://loro.dev)

Rank: #3165Downloads: 1,534,103 (30 days)Stars: 23Forks: 4

Description

PyPI version License

<h1 align="center">loro-py</h1> <p align="center"> <a aria-label="X" href="https://x.com/loro_dev" target="_blank"> <img alt="" src="https://img.shields.io/badge/Twitter-black?style=for-the-badge&logo=Twitter"> </a> <a aria-label="Discord-Link" href="https://discord.gg/tUsBSVfqzf" target="_blank"> <img alt="" src="https://img.shields.io/badge/Discord-black?style=for-the-badge&logo=discord"> </a> </p>

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